/**
 *
 */
import OSS;
import OpenPlatform;
import OSSUtil;
import FileForm;
import OpenApi;
import OpenApi.OpenApiUtil;

extends OpenApi;


init(config: OpenApiUtil.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('energyexpertexternal', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!$isNull(endpoint)) {
    return endpoint;
  }
  
  if (!$isNull(endpointMap) && !$isNull(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return OpenApiUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model CarbonEmissionElecSummaryItem {
  carbonEmissionData?: double(name='carbonEmissionData'),
  dataUnit?: string(name='dataUnit'),
  name?: string(name='name'),
  ratio?: double(name='ratio'),
  rawData?: double(name='rawData'),
}

model ConstituteItem {
  carbonEmissionData?: double(name='carbonEmissionData'),
  dataUnit?: string(name='dataUnit'),
  emissionSource?: string(name='emissionSource'),
  emissionSourceKey?: string(name='emissionSourceKey'),
  enterpriseName?: string(name='enterpriseName'),
  envGasEmissions?: [ 
    {
      carbonEmissionData?: double(name='carbonEmissionData'),
      gasEmissionData?: double(name='gasEmissionData'),
      name?: string(name='name'),
      type?: string(name='type'),
    }
  ](name='envGasEmissions'),
  name?: string(name='name'),
  nameKey?: string(name='nameKey'),
  ratio?: double(name='ratio'),
  rawData?: double(name='rawData'),
  subConstituteItems?: [
    ConstituteItem
  ](name='subConstituteItems'),
}

model ContentItem {
  extInfo?: [ 
    {
      alignment?: string(name='alignment', example='center'),
      index?: long(name='index', example='8'),
      level?: long(name='level', example='2'),
      pageNum?: [ long ](name='pageNum'),
      pos?: [ 
        {
          x?: long(name='x', example='1'),
          y?: long(name='y', example='2'),
        }
      ](name='pos'),
      subType?: string(name='subType', example='picture'),
      text?: string(name='text', example='版面内容'),
      type?: string(name='type', example='table'),
      uniqueId?: string(name='uniqueId', example='88c712db271443dd4e3697cb9b5dab3a'),
    }
  ](name='extInfo'),
  score?: double(name='score', example='0.45'),
  text?: string(name='text'),
  type?: string(name='type', example='img'),
}

model EpdInventoryConstituteItem {
  carbonEmission?: double(name='carbonEmission'),
  factor?: string(name='factor'),
  factorDataset?: string(name='factorDataset'),
  factorId?: string(name='factorId'),
  factorType?: int32(name='factorType'),
  factorUnit?: string(name='factorUnit'),
  inventoryId?: long(name='inventoryId'),
  inventoryUnit?: string(name='inventoryUnit'),
  inventoryValue?: double(name='inventoryValue'),
  inventoryValuePerProduct?: double(name='inventoryValuePerProduct'),
  inventoryValuePerProductUnit?: string(name='inventoryValuePerProductUnit'),
  items?: [
    EpdInventoryConstituteItem
  ](name='items'),
  name?: string(name='name'),
  num?: long(name='num'),
  percent?: double(name='percent'),
  quantity?: double(name='quantity'),
  resourceType?: string(name='resourceType'),
  state?: int32(name='state'),
  unit?: string(name='unit'),
}

model GwpInventoryConstitute {
  byResourceType?: [
    GwpResourceConstitute
  ](name='byResourceType'),
  carbonEmission?: double(name='carbonEmission'),
  items?: [
    GwpInventoryConstitute
  ](name='items'),
  name?: string(name='name'),
  percent?: double(name='percent'),
  resourceType?: int32(name='resourceType'),
  unit?: string(name='unit'),
}

model GwpResourceConstitute {
  carbonEmission?: double(name='carbonEmission'),
  name?: string(name='name'),
  percent?: string(name='percent'),
  resourceType?: int32(name='resourceType'),
  unit?: string(name='unit'),
}

model OrgEmission {
  carbonEmissionData?: double(name='carbonEmissionData'),
  moduleEmissionList?: [ 
    {
      carbonEmissionData?: double(name='carbonEmissionData'),
      name?: string(name='name'),
      nameKey?: string(name='nameKey'),
      ratio?: double(name='ratio'),
    }
  ](name='moduleEmissionList'),
  name?: string(name='name'),
  nameKey?: string(name='nameKey'),
  ratio?: double(name='ratio'),
  subEmissionItems?: [
    OrgEmission
  ](name='subEmissionItems'),
  weightingCarbonEmissionData?: double(name='weightingCarbonEmissionData'),
  weightingProportion?: double(name='weightingProportion'),
  weightingRatio?: double(name='weightingRatio'),
}

model AnalyzeVlRealtimeRequest {
  fileUrl?: string(name='fileUrl', description='Choose one of fileUrl or fileUrlObject:

- fileUrl: Use in the form of a document URL, for a single document (supports up to 1000 pages and 100MB)

- fileUrlObject: Use when calling the interface with local file upload, for a single document (supports up to 1000 pages and 100 MB)

> The relationship between file parsing methods and supported document types
> - Long Text RAG: Supports pdf, doc/docx, up to 1000 pages
> - Image Processing: Supports pdf, jpg, jpeg, png, bmp
> - Long Text Understanding: Supports pdf, doc/docx, xls/xlsx', example='fileUrl：https://example.com/example.pdf
fileUrlObject：本地文件生成的FileInputStream'),
  language?: string(name='language', description='Language, parameters that can be passed
- zh-CN: Chinese (default)
- en-US: English', example='zh-CN'),
  templateId?: string(name='templateId', description='A unique parsing template ID used to specify the key-value pairs to be extracted from the document. You need to log in to the template management page, configure the template, and then get the corresponding template ID.', example='572d24k0c95a'),
}

model AnalyzeVlRealtimeAdvanceRequest {
  fileUrlObject?: readable(name='fileUrl', description='Choose one of fileUrl or fileUrlObject:

- fileUrl: Use in the form of a document URL, for a single document (supports up to 1000 pages and 100MB)

- fileUrlObject: Use when calling the interface with local file upload, for a single document (supports up to 1000 pages and 100 MB)

> The relationship between file parsing methods and supported document types
> - Long Text RAG: Supports pdf, doc/docx, up to 1000 pages
> - Image Processing: Supports pdf, jpg, jpeg, png, bmp
> - Long Text Understanding: Supports pdf, doc/docx, xls/xlsx', example='fileUrl：https://example.com/example.pdf
fileUrlObject：本地文件生成的FileInputStream'),
  language?: string(name='language', description='Language, parameters that can be passed
- zh-CN: Chinese (default)
- en-US: English', example='zh-CN'),
  templateId?: string(name='templateId', description='A unique parsing template ID used to specify the key-value pairs to be extracted from the document. You need to log in to the template management page, configure the template, and then get the corresponding template ID.', example='572d24k0c95a'),
}

model AnalyzeVlRealtimeResponseBody = {
  data?: {
    kvListInfo?: [ 
      {
        context?: {
          confidence?: {
            keyConfidence?: double(name='keyConfidence', description='Key confidence', example='0.9994202852249146'),
            valueConfidence?: double(name='valueConfidence', description='Value confidence', example='0.9794202852249146'),
          }(name='confidence', description='Confidence'),
          key?: [
            ContentItem
          ](name='key', description='Key recall information details'),
          value?: [
            ContentItem
          ](name='value', description='Value recall information details'),
        }(name='context', description='Recall content'),
        keyName?: string(name='keyName', description='Field Key name', example='username'),
        keyValue?: string(name='keyValue', description='Field key value', example='bob'),
      }
    ](name='kvListInfo', description='Document parsing result details'),
  }(name='data', description='Return result.'),
  requestId?: string(name='requestId', description='Request ID.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model AnalyzeVlRealtimeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AnalyzeVlRealtimeResponseBody(name='body'),
}

/**
 * @summary Get Document Results
 *
 * @description Users obtain real-time VL results by uploading a document URL.
 *
 * @param request AnalyzeVlRealtimeRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return AnalyzeVlRealtimeResponse
 */
async function analyzeVlRealtimeWithOptions(request: AnalyzeVlRealtimeRequest, headers: map[string]string, runtime: $RuntimeOptions): AnalyzeVlRealtimeResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.fileUrl)) {
    query['fileUrl'] = request.fileUrl;
  }
  if (!$isNull(request.language)) {
    query['language'] = request.language;
  }
  if (!$isNull(request.templateId)) {
    query['templateId'] = request.templateId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'AnalyzeVlRealtime',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/aidoc/document/analyzeVlRealtime`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Get Document Results
 *
 * @description Users obtain real-time VL results by uploading a document URL.
 *
 * @param request AnalyzeVlRealtimeRequest
 * @return AnalyzeVlRealtimeResponse
 */
async function analyzeVlRealtime(request: AnalyzeVlRealtimeRequest): AnalyzeVlRealtimeResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return analyzeVlRealtimeWithOptions(request, headers, runtime);
}

async function analyzeVlRealtimeAdvance(request: AnalyzeVlRealtimeAdvanceRequest, headers: map[string]string, runtime: $RuntimeOptions): AnalyzeVlRealtimeResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if($isNull(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if($isNull(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApiUtil.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'energyExpertExternal',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var analyzeVlRealtimeReq = new AnalyzeVlRealtimeRequest{};
  OpenApiUtil.convert(request, analyzeVlRealtimeReq);

  if(!$isNull(request.fileUrlObject)) {
    authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
    ossConfig.accessKeyId = authResponse.body.accessKeyId;
    ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
    ossClient = new OSS(ossConfig);

    fileObj = new FileForm.FileField{
      filename = authResponse.body.objectKey,
      content = request.fileUrlObject,
      contentType = '',
    };
    ossHeader = new OSS.PostObjectRequest.header{
      accessKeyId = authResponse.body.accessKeyId,
      policy = authResponse.body.encodedPolicy,
      signature = authResponse.body.signature,
      key = authResponse.body.objectKey,
      file = fileObj,
      successActionStatus = '201',
    };
    uploadRequest = new OSS.PostObjectRequest{
      bucketName = authResponse.body.bucket,
      header = ossHeader,
    };
    ossClient.postObject(uploadRequest, ossRuntime);
    analyzeVlRealtimeReq.fileUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
  }
  var analyzeVlRealtimeResp = analyzeVlRealtimeWithOptions(analyzeVlRealtimeReq, headers, runtime);
  return analyzeVlRealtimeResp;
}

model BatchSaveInstructionStatusRequest {
  factoryId?: string(name='factoryId', description='This parameter is required.', example='***'),
  pKey?: string(name='pKey', example='ib'),
  statusList?: string(name='statusList'),
}

model BatchSaveInstructionStatusResponseBody = {
  data?: boolean(name='data', description='true', example='true'),
  requestId?: string(name='requestId', description='Id of the request', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model BatchSaveInstructionStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: BatchSaveInstructionStatusResponseBody(name='body'),
}

/**
 * @summary 策略执行状态反馈
 *
 * @param request BatchSaveInstructionStatusRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return BatchSaveInstructionStatusResponse
 */
async function batchSaveInstructionStatusWithOptions(request: BatchSaveInstructionStatusRequest, headers: map[string]string, runtime: $RuntimeOptions): BatchSaveInstructionStatusResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.factoryId)) {
    body['factoryId'] = request.factoryId;
  }
  if (!$isNull(request.pKey)) {
    body['pKey'] = request.pKey;
  }
  if (!$isNull(request.statusList)) {
    body['statusList'] = request.statusList;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'BatchSaveInstructionStatus',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/hvac/batchSaveInstructionStatus`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 策略执行状态反馈
 *
 * @param request BatchSaveInstructionStatusRequest
 * @return BatchSaveInstructionStatusResponse
 */
async function batchSaveInstructionStatus(request: BatchSaveInstructionStatusRequest): BatchSaveInstructionStatusResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return batchSaveInstructionStatusWithOptions(request, headers, runtime);
}

model BatchUpdateSystemRunningPlanRequest {
  controlType?: int32(name='controlType', example='0'),
  dateType?: int32(name='dateType', example='0'),
  earliestStartupTime?: string(name='earliestStartupTime', example='05:00:00'),
  endTime?: string(name='endTime', description='This parameter is required.', example='2024-08-30'),
  factoryId?: string(name='factoryId', description='This parameter is required.', example='***'),
  latestShutdownTime?: string(name='latestShutdownTime', example='05:30:00'),
  maxCarbonDioxide?: double(name='maxCarbonDioxide', example='37.1'),
  maxTem?: double(name='maxTem', example='25.3'),
  minTem?: double(name='minTem', example='20.1'),
  seasonMode?: int32(name='seasonMode', example='0'),
  startTime?: string(name='startTime', description='This parameter is required.', example='2024-08-21'),
  systemId?: string(name='systemId', description='This parameter is required.', example='system1'),
  workingEndTime?: string(name='workingEndTime', example='05:30:00'),
  workingStartTime?: string(name='workingStartTime', example='05:00:00'),
}

model BatchUpdateSystemRunningPlanResponseBody = {
  data?: boolean(name='data', example='true'),
  requestId?: string(name='requestId', description='Id of the request', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model BatchUpdateSystemRunningPlanResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: BatchUpdateSystemRunningPlanResponseBody(name='body'),
}

/**
 * @summary 批量设置空调站点运行计划
 *
 * @param request BatchUpdateSystemRunningPlanRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return BatchUpdateSystemRunningPlanResponse
 */
async function batchUpdateSystemRunningPlanWithOptions(request: BatchUpdateSystemRunningPlanRequest, headers: map[string]string, runtime: $RuntimeOptions): BatchUpdateSystemRunningPlanResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.controlType)) {
    body['controlType'] = request.controlType;
  }
  if (!$isNull(request.dateType)) {
    body['dateType'] = request.dateType;
  }
  if (!$isNull(request.earliestStartupTime)) {
    body['earliestStartupTime'] = request.earliestStartupTime;
  }
  if (!$isNull(request.endTime)) {
    body['endTime'] = request.endTime;
  }
  if (!$isNull(request.factoryId)) {
    body['factoryId'] = request.factoryId;
  }
  if (!$isNull(request.latestShutdownTime)) {
    body['latestShutdownTime'] = request.latestShutdownTime;
  }
  if (!$isNull(request.maxCarbonDioxide)) {
    body['maxCarbonDioxide'] = request.maxCarbonDioxide;
  }
  if (!$isNull(request.maxTem)) {
    body['maxTem'] = request.maxTem;
  }
  if (!$isNull(request.minTem)) {
    body['minTem'] = request.minTem;
  }
  if (!$isNull(request.seasonMode)) {
    body['seasonMode'] = request.seasonMode;
  }
  if (!$isNull(request.startTime)) {
    body['startTime'] = request.startTime;
  }
  if (!$isNull(request.systemId)) {
    body['systemId'] = request.systemId;
  }
  if (!$isNull(request.workingEndTime)) {
    body['workingEndTime'] = request.workingEndTime;
  }
  if (!$isNull(request.workingStartTime)) {
    body['workingStartTime'] = request.workingStartTime;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'BatchUpdateSystemRunningPlan',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/hvac/batchUpdateSystemRunningPlan`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 批量设置空调站点运行计划
 *
 * @param request BatchUpdateSystemRunningPlanRequest
 * @return BatchUpdateSystemRunningPlanResponse
 */
async function batchUpdateSystemRunningPlan(request: BatchUpdateSystemRunningPlanRequest): BatchUpdateSystemRunningPlanResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return batchUpdateSystemRunningPlanWithOptions(request, headers, runtime);
}

model EditProhibitedDevicesRequest {
  factoryId?: string(name='factoryId', description='This parameter is required.', example='***'),
  hvacDeviceConfigVOList?: [ 
    {
      buildingId?: string(name='buildingId', example='build_01'),
      deviceId?: string(name='deviceId', example='id1'),
      deviceName?: string(name='deviceName', example='name1'),
      deviceType?: string(name='deviceType', description='This parameter is required.', example='1'),
      fenceId?: string(name='fenceId', example='fence_01'),
      floorId?: string(name='floorId', example='floor_01'),
      isForbidden?: int32(name='isForbidden', description='This parameter is required.', example='1'),
      isUnfavorableArea?: int32(name='isUnfavorableArea', example='1'),
    }
  ](name='hvacDeviceConfigVOList', description='This parameter is required.'),
  systemId?: string(name='systemId', description='This parameter is required.', example='system1'),
}

model EditProhibitedDevicesResponseBody = {
  data?: boolean(name='data', example='true'),
  requestId?: string(name='requestId', description='Id of the request', example='9bc20a5a-b26b-4c28-922a-7cd10b61f96f'),
}

model EditProhibitedDevicesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: EditProhibitedDevicesResponseBody(name='body'),
}

/**
 * @summary 编辑禁用设备
 *
 * @param request EditProhibitedDevicesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return EditProhibitedDevicesResponse
 */
async function editProhibitedDevicesWithOptions(request: EditProhibitedDevicesRequest, headers: map[string]string, runtime: $RuntimeOptions): EditProhibitedDevicesResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.factoryId)) {
    body['factoryId'] = request.factoryId;
  }
  if (!$isNull(request.hvacDeviceConfigVOList)) {
    body['hvacDeviceConfigVOList'] = request.hvacDeviceConfigVOList;
  }
  if (!$isNull(request.systemId)) {
    body['systemId'] = request.systemId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'EditProhibitedDevices',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/hvac/editProhibitedDevices`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 编辑禁用设备
 *
 * @param request EditProhibitedDevicesRequest
 * @return EditProhibitedDevicesResponse
 */
async function editProhibitedDevices(request: EditProhibitedDevicesRequest): EditProhibitedDevicesResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return editProhibitedDevicesWithOptions(request, headers, runtime);
}

model EditUnfavorableAreaDevicesRequest {
  factoryId?: string(name='factoryId', description='This parameter is required.', example='***'),
  hvacDeviceConfigVOList?: [ 
    {
      buildingId?: string(name='buildingId', example='buildingId1'),
      deviceId?: string(name='deviceId', example='id1'),
      deviceName?: string(name='deviceName', example='name1'),
      deviceType?: string(name='deviceType', description='This parameter is required.', example='1'),
      fenceId?: string(name='fenceId', example='fenceId1'),
      floorId?: string(name='floorId', example='floorId2'),
      isForbidden?: int32(name='isForbidden', example='1'),
      isUnfavorableArea?: int32(name='isUnfavorableArea', description='This parameter is required.', example='1'),
    }
  ](name='hvacDeviceConfigVOList', description='This parameter is required.'),
  systemId?: string(name='systemId', description='This parameter is required.', example='system1'),
}

model EditUnfavorableAreaDevicesResponseBody = {
  data?: boolean(name='data', example='true'),
  requestId?: string(name='requestId', description='Id of the request', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model EditUnfavorableAreaDevicesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: EditUnfavorableAreaDevicesResponseBody(name='body'),
}

/**
 * @summary 编辑不利区设备
 *
 * @param request EditUnfavorableAreaDevicesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return EditUnfavorableAreaDevicesResponse
 */
async function editUnfavorableAreaDevicesWithOptions(request: EditUnfavorableAreaDevicesRequest, headers: map[string]string, runtime: $RuntimeOptions): EditUnfavorableAreaDevicesResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.factoryId)) {
    body['factoryId'] = request.factoryId;
  }
  if (!$isNull(request.hvacDeviceConfigVOList)) {
    body['hvacDeviceConfigVOList'] = request.hvacDeviceConfigVOList;
  }
  if (!$isNull(request.systemId)) {
    body['systemId'] = request.systemId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'EditUnfavorableAreaDevices',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/hvac/editUnfavorableAreaDevices`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 编辑不利区设备
 *
 * @param request EditUnfavorableAreaDevicesRequest
 * @return EditUnfavorableAreaDevicesResponse
 */
async function editUnfavorableAreaDevices(request: EditUnfavorableAreaDevicesRequest): EditUnfavorableAreaDevicesResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return editUnfavorableAreaDevicesWithOptions(request, headers, runtime);
}

model GenerateResultRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='C-20080808-1'),
  productId?: long(name='productId', description='The product id.

This parameter is required.', example='1024'),
  productType?: long(name='productType', description='Product type: 1 indicates that the carbon footprint of the product is requested, and 5 indicates that the carbon footprint of the supply chain is requested.

This parameter is required.', example='1'),
}

model GenerateResultResponseBody = {
  data?: boolean(name='data', description='The returned data. `true` indicates that the request is successful, `false` indicates that the request fails.', example='true'),
  requestId?: string(name='requestId', description='The ID of the request. The value is unique for each request. This facilitates subsequent troubleshooting.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model GenerateResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GenerateResultResponseBody(name='body'),
}

/**
 * @summary Generate a report of the specified carbon footprint.
 *
 * @description Given a product ID, this API initiates a task to calculate the carbon footprint result for the corresponding product. The task\\"s status can be checked using the `IsCompleted` API. Following the generation of results, other result inquiry APIs can be accessed for display content.
 *
 * @param request GenerateResultRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GenerateResultResponse
 */
async function generateResultWithOptions(request: GenerateResultRequest, headers: map[string]string, runtime: $RuntimeOptions): GenerateResultResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.productId)) {
    body['productId'] = request.productId;
  }
  if (!$isNull(request.productType)) {
    body['productType'] = request.productType;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GenerateResult',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/footprint/result/generate`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Generate a report of the specified carbon footprint.
 *
 * @description Given a product ID, this API initiates a task to calculate the carbon footprint result for the corresponding product. The task\\"s status can be checked using the `IsCompleted` API. Following the generation of results, other result inquiry APIs can be accessed for display content.
 *
 * @param request GenerateResultRequest
 * @return GenerateResultResponse
 */
async function generateResult(request: GenerateResultRequest): GenerateResultResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return generateResultWithOptions(request, headers, runtime);
}

model GetAreaElecConstituteRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='Z-20240115-2'),
  year?: int32(name='year', description='Year.

This parameter is required.', example='2024'),
}

model GetAreaElecConstituteResponseBody = {
  code?: string(name='code', description='The code returned for the request. A value of Success indicates that the request was successful. Other values indicate that the request failed. You can troubleshoot the error by viewing the error message returned.', example='200'),
  data?: {
    light?: [
      CarbonEmissionElecSummaryItem
    ](name='light', description='Photoelectric power consumption and carbon emission data of each enterprise.'),
    nuclear?: [
      CarbonEmissionElecSummaryItem
    ](name='nuclear', description='Data on nuclear power consumption and carbon emissions at each enterprise.'),
    renewing?: [
      CarbonEmissionElecSummaryItem
    ](name='renewing', description='Data on renewable electricity consumption and carbon emissions at each enterprise.'),
    urban?: [
      CarbonEmissionElecSummaryItem
    ](name='urban', description='Data on mains electricity consumption and carbon emission of each enterprise.'),
    water?: [
      CarbonEmissionElecSummaryItem
    ](name='water', description='Hydropower consumption and carbon emission data of each enterprise.'),
    wind?: [
      CarbonEmissionElecSummaryItem
    ](name='wind', description='Wind power consumption and carbon emission data of each enterprise.'),
    zero?: [
      CarbonEmissionElecSummaryItem
    ](name='zero', description='Data of zero electricity consumption and carbon emission of each enterprise.'),
  }(name='data', description='The returned data.'),
  requestId?: string(name='requestId', description='The request ID.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model GetAreaElecConstituteResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAreaElecConstituteResponseBody(name='body'),
}

/**
 * @summary This interface is used to obtain electrical constitute analysis data.
 *
 * @param request GetAreaElecConstituteRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAreaElecConstituteResponse
 */
async function getAreaElecConstituteWithOptions(request: GetAreaElecConstituteRequest, headers: map[string]string, runtime: $RuntimeOptions): GetAreaElecConstituteResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.year)) {
    body['year'] = request.year;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetAreaElecConstitute',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/emission/analysis/elec/area`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary This interface is used to obtain electrical constitute analysis data.
 *
 * @param request GetAreaElecConstituteRequest
 * @return GetAreaElecConstituteResponse
 */
async function getAreaElecConstitute(request: GetAreaElecConstituteRequest): GetAreaElecConstituteResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getAreaElecConstituteWithOptions(request, headers, runtime);
}

model GetCarbonEmissionTrendRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='C-20240119-1'),
  moduleCode?: string(name='moduleCode', description='Module code.', example='carbonInventory.check.scope_1_direct_ghg_emissions'),
  moduleType?: int32(name='moduleType', description='Module type.', example='3'),
  trendType?: int32(name='trendType', description='Trend Type.

This parameter is required.', example='0'),
  yearList?: [ int32 ](name='yearList', description='The list of inventory year.

This parameter is required.'),
}

model GetCarbonEmissionTrendResponseBody = {
  data?: {
    actualEmissionList?: [ 
      {
        items?: [ 
          {
            carbonEmissionData?: double(name='carbonEmissionData', description='Carbon emissions.', example='20.22'),
            month?: int32(name='month', description='The month.', example='11'),
            year?: string(name='year', description='The year.', example='2024'),
          }
        ](name='items', description='Data item list.'),
        year?: string(name='year', description='The year.', example='2024'),
      }
    ](name='actualEmissionList', description='Actual emission list.'),
    targetEmissionList?: [ 
      {
        items?: [ 
          {
            carbonEmissionData?: double(name='carbonEmissionData', description='Carbon emissions.', example='20.22'),
            month?: int32(name='month', description='The month.', example='10'),
            year?: string(name='year', description='The year.', example='2024'),
          }
        ](name='items', description='Data item list.'),
        year?: string(name='year', description='The year.', example='2024'),
      }
    ](name='targetEmissionList', description='Target Emission List.'),
  }(name='data', description='The response parameters.'),
  requestId?: string(name='requestId', description='Id of the request.', example='9bc20a5a-b26b-4c28-922a-7cd10b61f96f'),
}

model GetCarbonEmissionTrendResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetCarbonEmissionTrendResponseBody(name='body'),
}

/**
 * @summary Get trends in carbon emissions.
 *
 * @param request GetCarbonEmissionTrendRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetCarbonEmissionTrendResponse
 */
async function getCarbonEmissionTrendWithOptions(request: GetCarbonEmissionTrendRequest, headers: map[string]string, runtime: $RuntimeOptions): GetCarbonEmissionTrendResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.moduleCode)) {
    body['moduleCode'] = request.moduleCode;
  }
  if (!$isNull(request.moduleType)) {
    body['moduleType'] = request.moduleType;
  }
  if (!$isNull(request.trendType)) {
    body['trendType'] = request.trendType;
  }
  if (!$isNull(request.yearList)) {
    body['yearList'] = request.yearList;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetCarbonEmissionTrend',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/emission/analysis/trend`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Get trends in carbon emissions.
 *
 * @param request GetCarbonEmissionTrendRequest
 * @return GetCarbonEmissionTrendResponse
 */
async function getCarbonEmissionTrend(request: GetCarbonEmissionTrendRequest): GetCarbonEmissionTrendResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getCarbonEmissionTrendWithOptions(request, headers, runtime);
}

model GetDataItemListRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='C-202302-01'),
}

model GetDataItemListResponseBody = {
  data?: [ 
    {
      code?: string(name='code', description='The identifier of the data item.', example='demo_api_code'),
      name?: string(name='name', description='The name of the data item.', example='name_bbb'),
      period?: int32(name='period', description='Data filling method, 1: monthly value 2: annual value.', example='1'),
      unit?: string(name='unit', description='The data item unit.', example='kg'),
    }
  ](name='data', description='Response parameters.'),
  requestId?: string(name='requestId', description='The request ID.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model GetDataItemListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetDataItemListResponseBody(name='body'),
}

/**
 * @summary This interface is used to obtain the details category of a data item.
 *
 * @description - obtain data item detail list under the current enterprise.
 *
 * @param request GetDataItemListRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetDataItemListResponse
 */
async function getDataItemListWithOptions(request: GetDataItemListRequest, headers: map[string]string, runtime: $RuntimeOptions): GetDataItemListResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetDataItemList',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/emission/data/item/list`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary This interface is used to obtain the details category of a data item.
 *
 * @description - obtain data item detail list under the current enterprise.
 *
 * @param request GetDataItemListRequest
 * @return GetDataItemListResponse
 */
async function getDataItemList(request: GetDataItemListRequest): GetDataItemListResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getDataItemListWithOptions(request, headers, runtime);
}

model GetDataQualityAnalysisRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='C-20080808-1'),
  dataQualityEvaluationType?: long(name='dataQualityEvaluationType', description='Data quality assessment type: 1 is DQI and 2 is DQR.

This parameter is required.', example='1'),
  productId?: long(name='productId', description='The product id.

This parameter is required.', example='1024'),
  productType?: long(name='productType', description='Product type: 1 indicates that the carbon footprint of the product is requested, and 5 indicates that the carbon footprint of the supply chain is requested.

This parameter is required.', example='1'),
}

model GetDataQualityAnalysisResponseBody = {
  data?: {
    dataQuality?: [ 
      {
        inventory?: string(name='inventory', description='Inventory name', example='energy'),
        score?: {
          g1?: double(name='g1', description='Data quality evaluation indicator 1: activity data credibility.', example='3'),
          g2?: double(name='g2', description='Data quality evaluation indicator 2: data factor reliability.', example='3'),
          g3?: double(name='g3', description='Data quality evaluation indicator 3: time representativeness.', example='3'),
          g4?: double(name='g4', description='Data quality evaluation indicator 4: geographic representativeness.', example='3'),
        }(name='score', description='Score. The distribution ranges from 1 to 5. A value closer to 1 indicates better data quality.'),
      }
    ](name='dataQuality', description='Score of each inventory.'),
    dataQualityResult?: {
      dataQualityScore?: double(name='data_quality_score', description='The score. This parameter is applicable to DQR results. The distribution ranges from 1 to 5. A value closer to 1 indicates better data quality. The number of valid digits is kept to four decimal places.', example='1.2345'),
      g1?: double(name='g1', description='Data quality evaluation indicator 1: activity data credibility.', example='1.2345'),
      g2?: double(name='g2', description='Data quality evaluation indicator 2: data factor reliability.', example='1.2345'),
      g3?: double(name='g3', description='Data quality evaluation indicator 3: time representativeness.', example='1.2345'),
      g4?: double(name='g4', description='Data quality evaluation indicator 4: geographic representativeness.', example='1.2345'),
    }(name='dataQualityResult', description='Data quality result.'),
    sensitivityList?: [ 
      {
        id?: string(name='id', description='Inventory id', example='1'),
        inventory?: string(name='inventory', description='Name of the inventory item.', example='energy'),
        reductionList?: [ string ](name='reductionList', description='List of emission reduction measures.'),
        sensitivity?: double(name='sensitivity', description='Sensitivity percentage.', example='91.7'),
      }
    ](name='sensitivityList', description='Sensitivity analysis list'),
    uncertainty?: string(name='uncertainty', description='Uncertainty value. The model\\\\"s overall percentage uncertainty results. "10.00%" symbolizes a 10.00% uncertainty, indicating that the carbon footprint lies within ±10.00%. This is derived from a weighted aggregation of individual inventory uncertainties.', example='10.00'),
    uncertaintyValues?: [ 
      {
        inventory?: string(name='inventory', description='The name of the inventory. Format: process name / inventory name.', example='process-1/inventory-1'),
        uncertaintyContribution?: string(name='uncertaintyContribution', description='Inventory uncertainty absolute contribution size. The impact of the quality of each inventory data on the carbon footprint results in the modeling process, when the uncertain contribution of a list is large, please improve its data quality as much as possible to improve the accuracy of carbon footprint analysis. The meaning of "1.4964" is not determined to contribute 1.4964 kgCO₂ e/unit, where unit is the unit of the product.', example='1.4964'),
      }
    ](name='uncertaintyValues', description='Uncertainty list'),
  }(name='data', description='The response parameters.'),
  requestId?: string(name='requestId', description='The ID of the request. The value is unique for each request. This facilitates subsequent troubleshooting.', example='4A0AEC56-5C9A-5D47-93DF-7227836FFF82'),
}

model GetDataQualityAnalysisResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetDataQualityAnalysisResponseBody(name='body'),
}

/**
 * @summary Obtain the data quality evaluation results DQR and DQI.
 *
 * @description This API returns the data quality evaluation results based on the user-provided product ID. It\\"s useful for understanding the data quality of the carbon emission factors for each inventory of the product.
 *
 * @param request GetDataQualityAnalysisRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetDataQualityAnalysisResponse
 */
async function getDataQualityAnalysisWithOptions(request: GetDataQualityAnalysisRequest, headers: map[string]string, runtime: $RuntimeOptions): GetDataQualityAnalysisResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.dataQualityEvaluationType)) {
    body['dataQualityEvaluationType'] = request.dataQualityEvaluationType;
  }
  if (!$isNull(request.productId)) {
    body['productId'] = request.productId;
  }
  if (!$isNull(request.productType)) {
    body['productType'] = request.productType;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetDataQualityAnalysis',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/footprint/data/quality/analysis`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Obtain the data quality evaluation results DQR and DQI.
 *
 * @description This API returns the data quality evaluation results based on the user-provided product ID. It\\"s useful for understanding the data quality of the carbon emission factors for each inventory of the product.
 *
 * @param request GetDataQualityAnalysisRequest
 * @return GetDataQualityAnalysisResponse
 */
async function getDataQualityAnalysis(request: GetDataQualityAnalysisRequest): GetDataQualityAnalysisResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getDataQualityAnalysisWithOptions(request, headers, runtime);
}

model GetDeviceInfoRequest {
  deviceId?: string(name='deviceId', description='The ID of the device.

This parameter is required.', example='pn_69873'),
  ds?: string(name='ds', description='The time string in the YYYY-mm-dd format.

This parameter is required.', example='2022-07-26'),
  factoryId?: string(name='factoryId', description='The ID of the site.

This parameter is required.', example='pn_95'),
}

model GetDeviceInfoResponseBody = {
  code?: string(name='code', description='The code returned for the request. A value of Success indicates that the request was successful. Other values indicate that the request failed. You can troubleshoot the error by viewing the error message returned.', example='Success'),
  data?: {
    deviceId?: string(name='deviceId', description='The ID of the device.', example='pn_69873'),
    deviceName?: string(name='deviceName', description='The name of the device.', example='Main transformer 4#'),
    firstTypeName?: string(name='firstTypeName', description='The level 1 meter type.', example='Electric meter'),
    recordList?: [ 
      {
        identifier?: string(name='identifier', description='The device identifier.', example='Ia'),
        paramName?: string(name='paramName', description='The parameter name.', example='Phase A current'),
        statisticsDate?: string(name='statisticsDate', description='The date on which the statistics were collected.', example='2022-07-26 00:00:00'),
        type?: string(name='type', description='The type of the measuring point.', example='DOUBLE'),
        unit?: string(name='unit', description='The unit of the parameter value.', example='A'),
        value?: double(name='value', description='The value of the measuring point.', example='20.00'),
      }
    ](name='recordList', description='The device parameters.'),
    secondTypeName?: string(name='secondTypeName', description='The level 2 meter type.', example='Gateway meter'),
  }(name='data', description='The data returned.'),
  httpCode?: int32(name='httpCode', description='The HTTP status code.', example='200'),
  requestId?: string(name='requestId', description='The request ID.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='True'),
}

model GetDeviceInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetDeviceInfoResponseBody(name='body'),
}

/**
 * @summary Queries the information about a device at a site that is activated by using an Alibaba Cloud account.
 *
 * @description *   You can call this operation to query the parameters of a data collection device based on the device ID. If the verification is passed, the device parameters are returned. If the verification fails, a null value is returned.
 * *   You can query the parameters of a single device by day. If data of the device does not exist, a null value is returned.
 * - By current, endpoint only supports Hangzhou: `energyexpertexternal.cn-hangzhou.aliyuncs.com`.
 * - To use this API, you need to be added to the whitelist. Please contact us through  <props="china">[official website](https://energy.aliyun.com/ifa/web/defaultLoginPage?adapter=aliyun#/consult?source=%E8%83%BD%E8%80%97%E5%AE%9D%E7%99%BB%E5%BD%95%E9%A1%B5%EF%BC%88WEB%EF%BC%89) 
 * <props="intl">[official website](https://energy.alibabacloud.com/common?adapter=aliyun&lang=en-US#/home/en) to apply for whitelist activation.
 *
 * @param request GetDeviceInfoRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetDeviceInfoResponse
 */
async function getDeviceInfoWithOptions(request: GetDeviceInfoRequest, headers: map[string]string, runtime: $RuntimeOptions): GetDeviceInfoResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.deviceId)) {
    query['deviceId'] = request.deviceId;
  }
  if (!$isNull(request.ds)) {
    query['ds'] = request.ds;
  }
  if (!$isNull(request.factoryId)) {
    query['factoryId'] = request.factoryId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetDeviceInfo',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/external/getDeviceInfo`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about a device at a site that is activated by using an Alibaba Cloud account.
 *
 * @description *   You can call this operation to query the parameters of a data collection device based on the device ID. If the verification is passed, the device parameters are returned. If the verification fails, a null value is returned.
 * *   You can query the parameters of a single device by day. If data of the device does not exist, a null value is returned.
 * - By current, endpoint only supports Hangzhou: `energyexpertexternal.cn-hangzhou.aliyuncs.com`.
 * - To use this API, you need to be added to the whitelist. Please contact us through  <props="china">[official website](https://energy.aliyun.com/ifa/web/defaultLoginPage?adapter=aliyun#/consult?source=%E8%83%BD%E8%80%97%E5%AE%9D%E7%99%BB%E5%BD%95%E9%A1%B5%EF%BC%88WEB%EF%BC%89) 
 * <props="intl">[official website](https://energy.alibabacloud.com/common?adapter=aliyun&lang=en-US#/home/en) to apply for whitelist activation.
 *
 * @param request GetDeviceInfoRequest
 * @return GetDeviceInfoResponse
 */
async function getDeviceInfo(request: GetDeviceInfoRequest): GetDeviceInfoResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getDeviceInfoWithOptions(request, headers, runtime);
}

model GetDeviceListRequest {
  factoryId?: string(name='factoryId', description='The ID of the site.

This parameter is required.', example='pn_95'),
}

model GetDeviceListResponseBody = {
  code?: string(name='code', description='The response code.', example='Success'),
  data?: {
    code?: string(name='code', description='The code returned for the request.', example='Success'),
    deviceList?: [ 
      {
        deviceId?: string(name='deviceId', description='The device ID.', example='pn_69873'),
        deviceName?: string(name='deviceName', description='The device name.', example='Main transformer 4#'),
        firstTypeName?: string(name='firstTypeName', description='The level 1 meter type.', example='Electric meter'),
        info?: {
          constKva?: int32(name='constKva', description='The rated capacity.
Unit is kVA.', example='100'),
          ct?: int32(name='ct', description='The transformation ratio of current.', example='1'),
          magnification?: int32(name='magnification', description='The magnification ratio.', example='80'),
          pressure?: int32(name='pressure', description='The high and low voltage.', example='0'),
          pt?: int32(name='pt', description='The transformation ratio of voltage.', example='80'),
        }(name='info', description='The device information.'),
        parentDevice?: string(name='parentDevice', description='The ID of the parent device.', example='pn_6987'),
        secondTypeName?: string(name='secondTypeName', description='The level 2 meter type.', example='Gateway meter'),
      }
    ](name='deviceList', description='The devices.'),
    factoryId?: string(name='factoryId', description='The ID of the site.', example='pn_95'),
    httpCode?: int32(name='httpCode', description='The HTTP status code.', example='200'),
    success?: boolean(name='success', description='Indicates whether the request was successful.', example='True'),
  }(name='data', description='The data returned.'),
  httpCode?: int32(name='httpCode', description='The HTTP status code.', example='200'),
  requestId?: string(name='requestId', description='The request ID.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model GetDeviceListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetDeviceListResponseBody(name='body'),
}

/**
 * @summary Queries the devices of a site that is activated by using an Alibaba Cloud account.
 *
 * @description *   You can query the information about data collection devices of a site based on the ID of the site. If the verification is passed, the information about the devices of the site is returned. If the verification fails, a null value is returned.
 * *   Virtual meters at the site are not returned.
 * - By current, endpoint only supports Hangzhou: `energyexpertexternal.cn-hangzhou.aliyuncs.com`.
 * - To use this API, you need to be added to the whitelist. Please contact us through  <props="china">[official website](https://energy.aliyun.com/ifa/web/defaultLoginPage?adapter=aliyun#/consult?source=%E8%83%BD%E8%80%97%E5%AE%9D%E7%99%BB%E5%BD%95%E9%A1%B5%EF%BC%88WEB%EF%BC%89) 
 * <props="intl">[official website](https://energy.alibabacloud.com/common?adapter=aliyun&lang=en-US#/home/en) to apply for whitelist activation.
 *
 * @param request GetDeviceListRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetDeviceListResponse
 */
async function getDeviceListWithOptions(request: GetDeviceListRequest, headers: map[string]string, runtime: $RuntimeOptions): GetDeviceListResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.factoryId)) {
    query['factoryId'] = request.factoryId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetDeviceList',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/external/getDeviceList`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the devices of a site that is activated by using an Alibaba Cloud account.
 *
 * @description *   You can query the information about data collection devices of a site based on the ID of the site. If the verification is passed, the information about the devices of the site is returned. If the verification fails, a null value is returned.
 * *   Virtual meters at the site are not returned.
 * - By current, endpoint only supports Hangzhou: `energyexpertexternal.cn-hangzhou.aliyuncs.com`.
 * - To use this API, you need to be added to the whitelist. Please contact us through  <props="china">[official website](https://energy.aliyun.com/ifa/web/defaultLoginPage?adapter=aliyun#/consult?source=%E8%83%BD%E8%80%97%E5%AE%9D%E7%99%BB%E5%BD%95%E9%A1%B5%EF%BC%88WEB%EF%BC%89) 
 * <props="intl">[official website](https://energy.alibabacloud.com/common?adapter=aliyun&lang=en-US#/home/en) to apply for whitelist activation.
 *
 * @param request GetDeviceListRequest
 * @return GetDeviceListResponse
 */
async function getDeviceList(request: GetDeviceListRequest): GetDeviceListResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getDeviceListWithOptions(request, headers, runtime);
}

model GetDocExtractionResultRequest {
  taskId?: string(name='taskId', description='- Task ID.
- taskId is obtained from the SubmitDocExtractionTaskAdvance and SubmitDocExtractionTask interfaces.

This parameter is required.', example='97693b4c-17a8-4198-aa28-798d3c855577mhrv'),
}

model GetDocExtractionResultResponseBody = {
  data?: {
    kvListInfo?: [ 
      {
        context?: {
          confidence?: {
            keyConfidence?: double(name='keyConfidence', description='Key confidence level', example='0.9994202852249146'),
            valueConfidence?: double(name='valueConfidence', description='value confidence level', example='0.9794202852249146'),
          }(name='confidence', description='Confidence level'),
          key?: [
            ContentItem
          ](name='key', description='Details of key recall information'),
          value?: [
            ContentItem
          ](name='value', description='Details of value recall information'),
        }(name='context', description='Recalled content'),
        keyName?: string(name='keyName', description='Field key name', example='Tenant'),
        keyValue?: string(name='keyValue', description='Field key value', example='Alibaba Cloud XXX Co., Ltd.'),
      }
    ](name='kvListInfo', description='Details of document parsing results'),
  }(name='data', description='Returned data structure.'),
  requestId?: string(name='requestId', description='ID of the request', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model GetDocExtractionResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetDocExtractionResultResponseBody(name='body'),
}

/**
 * @summary For Querying Information Extraction Result.
 * The input parameter taskId is obtained from the taskId returned by the interfaces SubmitDocExtractionTaskAdvance or SubmitDocExtractionTask.
 * The query results can reflect one of three statuses: processing, successfully completed, or failed.
 *
 * @param request GetDocExtractionResultRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetDocExtractionResultResponse
 */
async function getDocExtractionResultWithOptions(request: GetDocExtractionResultRequest, headers: map[string]string, runtime: $RuntimeOptions): GetDocExtractionResultResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.taskId)) {
    body['taskId'] = request.taskId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetDocExtractionResult',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v2/aidoc/document/getDocExtractionResult`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary For Querying Information Extraction Result.
 * The input parameter taskId is obtained from the taskId returned by the interfaces SubmitDocExtractionTaskAdvance or SubmitDocExtractionTask.
 * The query results can reflect one of three statuses: processing, successfully completed, or failed.
 *
 * @param request GetDocExtractionResultRequest
 * @return GetDocExtractionResultResponse
 */
async function getDocExtractionResult(request: GetDocExtractionResultRequest): GetDocExtractionResultResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getDocExtractionResultWithOptions(request, headers, runtime);
}

model GetDocParsingResultRequest {
  returnFormat?: string(name='returnFormat', description='- The document parsing result supports two formats: markdown and json.
- By default, the result is returned in markdown format.', example='md'),
  taskId?: string(name='taskId', description='- Task ID.
- The taskId is obtained from the SubmitDocParsingTaskAdvance or SubmitDocParsingTask interfaces.

This parameter is required.', example='2c22388d-e2ed-44fe-99e6-99922f15e7bb'),
}

model GetDocParsingResultResponseBody = {
  data?: {
    content?: string(name='content', description='- The parsed content of the document.
- The format (markdown or json) is determined by the returnFormat parameter. For specific format details, refer to: [json return structure](https://www.alibabacloud.com/help/en/energy-expert/developer-reference/interface-attached-information#b644b6255cojj)', example='{\\\\"doc_info\\\\":{\\\\"languages\\\\":[\\\\"zh\\\\",\\\\"en\\\\"],\\\\"doc_type\\\\":\\\\"pdf\\\\",\\\\"pdf_toc\\\\":[{\\\\"title\\\\":\\\\"封面\\\\",\\\\"level\\\\":0,\\\\"page\\\\":0}],\\\\"pages\\\\":366,\\\\"page_list\\\\":[{\\\\"imageWidth\\\\":596,\\\\"imageHeight\\\\":842,\\\\"pageIdAllDocs\\\\":0,\\\\"fileIndex\\\\":0,\\\\"pageIdCurDoc\\\\":0,\\\\"angle\\\\":0}],\\\\"doc_data\\\\":[{\\\\"uniqueId\\\\":\\\\"about_us_para\\\\",\\\\"page_num\\\\":\\\\"01\\\\",\\\\"index\\\\":\\\\"xxx\\\\",\\\\"name\\\\":\\\\"xxx\\\\",\\\\"type\\\\":\\\\"xxxx\\\\",\\\\"subType\\\\":\\\\"xxx\\\\",\\\\"text\\\\":\\\\"xxx\\\\",\\\\"before_text\\\\":\\\\"xxx\\\\",\\\\"after_text\\\\":\\\\"xxx\\\\",\\\\"extInfo\\\\":[{\\\\"uniqueId\\\\":\\\\"b0x1x0\\\\",\\\\"pos\\\\":[{\\\\"x\\\\":229,\\\\"y\\\\":208},{\\\\"x\\\\":421,\\\\"y\\\\":208},{\\\\"x\\\\":421,\\\\"y\\\\":242},{\\\\"x\\\\":229,\\\\"y\\\\":242}],\\\\"text\\\\":\\\\"Kurt Götze\\\\",\\\\"type\\\\":\\\\"Text\\\\",\\\\"subType\\\\":\\\\"Text\\\\",\\\\"pageNum\\\\":[0],\\\\"index\\\\":0}]}]}}'),
  }(name='data', description='Returned result.'),
  requestId?: string(name='requestId', description='ID of the request', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model GetDocParsingResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetDocParsingResultResponseBody(name='body'),
}

/**
 * @summary For Querying Document Parsing Results.
 * The input parameter taskId is obtained from the taskId returned by the interfaces SubmitDocParsingTaskAdvance or SubmitDocParsingTask.
 * The query results can be one of three statuses: processing, successful, or failed.
 *
 * @param request GetDocParsingResultRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetDocParsingResultResponse
 */
async function getDocParsingResultWithOptions(request: GetDocParsingResultRequest, headers: map[string]string, runtime: $RuntimeOptions): GetDocParsingResultResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.returnFormat)) {
    body['returnFormat'] = request.returnFormat;
  }
  if (!$isNull(request.taskId)) {
    body['taskId'] = request.taskId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetDocParsingResult',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v2/aidoc/document/getDocParsingResult`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary For Querying Document Parsing Results.
 * The input parameter taskId is obtained from the taskId returned by the interfaces SubmitDocParsingTaskAdvance or SubmitDocParsingTask.
 * The query results can be one of three statuses: processing, successful, or failed.
 *
 * @param request GetDocParsingResultRequest
 * @return GetDocParsingResultResponse
 */
async function getDocParsingResult(request: GetDocParsingResultRequest): GetDocParsingResultResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getDocParsingResultWithOptions(request, headers, runtime);
}

model GetDocumentAnalyzeResultRequest {
  jobId?: string(name='jobId', description='Job ID, specifying which document\\\\"s parsing result to query. This is a return parameter from the \\\\"Submit Document Parsing Job\\\\" interface.

This parameter is required.', example='bfce2248-1546-4298-8bcf-70ac26e69646'),
}

model GetDocumentAnalyzeResultResponseBody = {
  data?: {
    kvListInfo?: [ 
      {
        context?: {
          confidence?: {
            keyConfidence?: double(name='keyConfidence', description='Confidence of Key', example='0.9994202852249146'),
            valueConfidence?: double(name='valueConfidence', description='Confidence of Value', example='0.9794202852249146'),
          }(name='confidence', description='Confidence'),
          key?: [
            ContentItem
          ](name='key', description='Key Recall Information'),
          value?: [
            ContentItem
          ](name='value', description='Value Recall Information'),
        }(name='context', description='Recalled Content'),
        keyName?: string(name='keyName', description='Field Key Name', example='Tenant'),
        keyValue?: string(name='keyValue', description='Field Key Value', example='Aliyun XXX Co., Ltd.'),
      }
    ](name='kvListInfo', description='Document Parsing Result'),
  }(name='data', description='Returned Data'),
  requestId?: string(name='requestId', description='Request ID', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model GetDocumentAnalyzeResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetDocumentAnalyzeResultResponseBody(name='body'),
}

/**
 * @summary Get document parsing/extraction result
 *
 * @param request GetDocumentAnalyzeResultRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetDocumentAnalyzeResultResponse
 */
async function getDocumentAnalyzeResultWithOptions(request: GetDocumentAnalyzeResultRequest, headers: map[string]string, runtime: $RuntimeOptions): GetDocumentAnalyzeResultResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.jobId)) {
    body['jobId'] = request.jobId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetDocumentAnalyzeResult',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/aidoc/document/getDocumentAnalyzeResult`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Get document parsing/extraction result
 *
 * @param request GetDocumentAnalyzeResultRequest
 * @return GetDocumentAnalyzeResultResponse
 */
async function getDocumentAnalyzeResult(request: GetDocumentAnalyzeResultRequest): GetDocumentAnalyzeResultResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getDocumentAnalyzeResultWithOptions(request, headers, runtime);
}

model GetElecConstituteRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='C-20240202-01'),
  year?: int32(name='year', description='Year.

This parameter is required.', example='2024'),
}

model GetElecConstituteResponseBody = {
  data?: {
    light?: {
      carbonEmissionData?: double(name='carbonEmissionData', description='Carbon emission.', example='1.2'),
      dataUnit?: string(name='dataUnit', description='The unit.', example='kWh'),
      name?: string(name='name', description='The name.', example='light'),
      nameKey?: string(name='nameKey', description='The unique identifier of name.', example='carbonInventory.check.light_electricity'),
      ratio?: double(name='ratio', description='Proportion of electricity consumption to all electricity consumption in the month: example value: 0.5 (i. e., 50%)', example='0.2'),
      rawData?: double(name='rawData', description='Electricity consumption', example='1.2'),
    }(name='light', description='Photoelectric power consumption and carbon emission data of each enterprise.'),
    nuclear?: {
      carbonEmissionData?: double(name='carbonEmissionData', description='Carbon emission.', example='2.3'),
      dataUnit?: string(name='dataUnit', description='The unit.', example='kWh'),
      name?: string(name='name', description='The name.', example='nuclear'),
      nameKey?: string(name='nameKey', description='The unique identifier of name.', example='carbonInventory.check.nuclear_electricity'),
      ratio?: double(name='ratio', description='Proportion of electricity consumption to all electricity consumption in the month: example value: 0.5 (i. e., 50%)', example='0.6'),
      rawData?: double(name='rawData', description='Electricity consumption', example='2'),
    }(name='nuclear', description='Data on nuclear power consumption and carbon emissions at each enterprise.'),
    renewing?: {
      carbonEmissionData?: double(name='carbonEmissionData', description='Carbon emission.', example='2.3'),
      dataUnit?: string(name='dataUnit', description='The unit.', example='kWh'),
      name?: string(name='name', description='The name.', example='renewing'),
      nameKey?: string(name='nameKey', description='The unique identifier of name.', example='carbonInventory.carbonEmissionAnalysis.components.CarbonDetail.keZaiShengZiYuan'),
      ratio?: double(name='ratio', description='Proportion of electricity consumption to all electricity consumption in the month: example value: 0.5 (i. e., 50%)', example='0.44'),
      rawData?: double(name='rawData', description='Electricity consumption', example='4.3'),
    }(name='renewing', description='Data on renewable electricity consumption and carbon emissions at each enterprise.'),
    urban?: {
      carbonEmissionData?: double(name='carbonEmissionData', description='Carbon emission.', example='1.2'),
      dataUnit?: string(name='dataUnit', description='The unit.', example='kWh'),
      name?: string(name='name', description='The name.', example='urban'),
      nameKey?: string(name='nameKey', description='The unique identifier of name.', example='carbonInventory.check.urban_electricity'),
      ratio?: double(name='ratio', description='Proportion of electricity consumption to all electricity consumption in the month: example value: 0.5 (i. e., 50%)', example='0.4'),
      rawData?: double(name='rawData', description='Electricity consumption', example='1.2'),
    }(name='urban', description='Data on mains power electricity consumption and carbon emission of each enterprise.'),
    water?: {
      carbonEmissionData?: double(name='carbonEmissionData', description='Carbon emission.', example='2.1'),
      dataUnit?: string(name='dataUnit', description='The unit.', example='kWh'),
      name?: string(name='name', description='The name.', example='water'),
      nameKey?: string(name='nameKey', description='The unique identifier of name.', example='carbonInventory.check.water_electricity'),
      ratio?: double(name='ratio', description='Proportion of electricity consumption to all electricity consumption in the month: example value: 0.5 (i. e., 50%)', example='0.4'),
      rawData?: double(name='rawData', description='Electricity consumption', example='1.2'),
    }(name='water', description='Hydropower consumption and carbon emission data of each enterprise.'),
    wind?: {
      carbonEmissionData?: double(name='carbonEmissionData', description='Carbon emission.', example='1.2'),
      dataUnit?: string(name='dataUnit', description='The unit.', example='kWh'),
      name?: string(name='name', description='The name.', example='wind'),
      nameKey?: string(name='nameKey', description='The unique identifier of name.', example='carbonInventory.check.wind_electricity'),
      ratio?: double(name='ratio', description='Proportion of electricity consumption to all electricity consumption in the month: example value: 0.5 (i. e., 50%)', example='0.3'),
      rawData?: double(name='rawData', description='Electricity consumption', example='1.1'),
    }(name='wind', description='Wind power consumption and carbon emission data of each enterprise.'),
    zero?: {
      carbonEmissionData?: double(name='carbonEmissionData', description='Carbon emission.', example='1.2'),
      dataUnit?: string(name='dataUnit', description='The unit.', example='kWh'),
      name?: string(name='name', description='The name.', example='zero'),
      nameKey?: string(name='nameKey', description='The unique identifier of name.', example='carbonInventory.carbonEmissionAnalysis.components.CarbonDetail.lingTanDianLi'),
      ratio?: double(name='ratio', description='Proportion of electricity consumption to all electricity consumption in the month: example value: 0.5 (i. e., 50%)', example='0.33'),
      rawData?: double(name='rawData', description='Electricity consumption', example='444.3'),
    }(name='zero', description='Data of zero electricity consumption and carbon emission of each enterprise.'),
  }(name='data', description='The returned data.'),
  requestId?: string(name='requestId', description='Id of the request.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model GetElecConstituteResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetElecConstituteResponseBody(name='body'),
}

/**
 * @summary This interface is used to obtain power composition analysis data.
 *
 * @param request GetElecConstituteRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetElecConstituteResponse
 */
async function getElecConstituteWithOptions(request: GetElecConstituteRequest, headers: map[string]string, runtime: $RuntimeOptions): GetElecConstituteResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.year)) {
    body['year'] = request.year;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetElecConstitute',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/emission/analysis/elec/constitute`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary This interface is used to obtain power composition analysis data.
 *
 * @param request GetElecConstituteRequest
 * @return GetElecConstituteResponse
 */
async function getElecConstitute(request: GetElecConstituteRequest): GetElecConstituteResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getElecConstituteWithOptions(request, headers, runtime);
}

model GetElecTrendRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='C-20240115-3'),
  yearList?: [ int32 ](name='yearList', description='List of years.

This parameter is required.'),
}

model GetElecTrendResponseBody = {
  code?: string(name='code', description='The code returned for the request. A value of Success indicates that the request was successful. Other values indicate that the request failed. You can troubleshoot the error by viewing the error message returned.', example='200'),
  data?: {
    light?: [ 
      {
        carbonEmissionData?: double(name='carbonEmissionData', description='Carbon emissions', example='3.14'),
        dataUnit?: string(name='dataUnit', description='The unit.', example='kWh'),
        month?: int32(name='month', description='Month', example='12'),
        name?: string(name='name', description='Power type name.', example='Solar Power'),
        nameKey?: string(name='nameKey', description='Power Type Code', example='carbonInventory.check.light_electricity'),
        ratio?: double(name='ratio', description='Proportion of electricity consumption to all electricity consumption in the month: example value: 0.5 (i. e. 50%).', example='0.5'),
        rawData?: double(name='rawData', description='Electricity consumption', example='3.14'),
        year?: string(name='year', description='Year', example='2024'),
      }
    ](name='light', description='Photoelectricity monthly electricity consumption and carbon emissions and other data.'),
    nuclear?: [ 
      {
        carbonEmissionData?: double(name='carbonEmissionData', description='Carbon emissions', example='3.14'),
        dataUnit?: string(name='dataUnit', description='The price unit.', example='kWh'),
        month?: int32(name='month', description='Month', example='12'),
        name?: string(name='name', description='Power Type Name', example='Nuclear power'),
        nameKey?: string(name='nameKey', description='Power Type Code', example='carbonInventory.check.nuclear_electricity'),
        ratio?: double(name='ratio', description='Proportion of electricity consumption to all electricity consumption in the month: example value: 0.5 (i. e., 50%)', example='0.5'),
        rawData?: double(name='rawData', description='Electricity consumption', example='3.14'),
        year?: string(name='year', description='Year', example='2024'),
      }
    ](name='nuclear', description='Monthly electricity consumption and carbon emissions data for nuclear power'),
    renewing?: [ 
      {
        carbonEmissionData?: double(name='carbonEmissionData', description='Carbon emissions', example='3.14'),
        dataUnit?: string(name='dataUnit', description='The price unit.', example='kWh'),
        month?: int32(name='month', description='Month', example='12'),
        name?: string(name='name', description='Power Type Name', example='Renewable electricity'),
        nameKey?: string(name='nameKey', description='Power Type Code', example='carbonInventory.carbonEmissionAnalysis.components.CarbonDetail.lingTanDianLi'),
        ratio?: double(name='ratio', description='Proportion of electricity consumption to all electricity consumption in the month: example value: 0.5 (i. e., 50%)', example='0.5'),
        rawData?: double(name='rawData', description='Electricity consumption', example='3.14'),
        year?: string(name='year', description='Year', example='2024'),
      }
    ](name='renewing', description='Monthly data on renewable electricity consumption and carbon emissions'),
    urban?: [ 
      {
        carbonEmissionData?: double(name='carbonEmissionData', description='Carbon emissions', example='3.14'),
        dataUnit?: string(name='dataUnit', description='The price unit.', example='kWh'),
        month?: int32(name='month', description='Month', example='12'),
        name?: string(name='name', description='Power Type Name', example='Grid power'),
        nameKey?: string(name='nameKey', description='Power Type Code', example='carbonInventory.check.urban_electricity'),
        ratio?: double(name='ratio', description='Proportion of electricity consumption to all electricity consumption in the month: example value: 0.5 (i. e. 50%).', example='0.5'),
        rawData?: double(name='rawData', description='Electricity consumption', example='3.14'),
        year?: string(name='year', description='Year', example='2024'),
      }
    ](name='urban', description='Data such as monthly electricity consumption and carbon emissions from the mains.'),
    water?: [ 
      {
        carbonEmissionData?: double(name='carbonEmissionData', description='Carbon emissions', example='3.14'),
        dataUnit?: string(name='dataUnit', description='The unit.', example='kWh'),
        month?: int32(name='month', description='Month', example='12'),
        name?: string(name='name', description='Power Type Name', example='Hydro power'),
        nameKey?: string(name='nameKey', description='Power Type Code', example='carbonInventory.check.water_electricity'),
        ratio?: double(name='ratio', description='Proportion of electricity consumption to all electricity consumption in the month: example value: 0.5 (i. e. 50%).', example='0.5'),
        rawData?: double(name='rawData', description='Electricity consumption', example='3.14'),
        year?: string(name='year', description='Year', example='2024'),
      }
    ](name='water', description='Monthly data on electricity consumption and carbon emissions for hydropower.'),
    wind?: [ 
      {
        carbonEmissionData?: double(name='carbonEmissionData', description='Carbon emissions', example='3.14'),
        dataUnit?: string(name='dataUnit', description='The price unit.', example='kWh'),
        month?: int32(name='month', description='Month', example='12'),
        name?: string(name='name', description='Power Type Name', example='Wind power'),
        nameKey?: string(name='nameKey', description='Power Type Code', example='carbonInventory.check.wind_electricity'),
        ratio?: double(name='ratio', description='Proportion of electricity consumption to all electricity consumption in the month: example value: 0.5 (i. e., 50%)', example='0.5'),
        rawData?: double(name='rawData', description='Electricity consumption', example='3.14'),
        year?: string(name='year', description='Year', example='2024'),
      }
    ](name='wind', description='Monthly wind power consumption and carbon emission data'),
    zero?: [ 
      {
        carbonEmissionData?: double(name='carbonEmissionData', description='Carbon emissions', example='3.14'),
        dataUnit?: string(name='dataUnit', description='The price unit.', example='kWh'),
        month?: int32(name='month', description='Month', example='12'),
        name?: string(name='name', description='Power Type Name', example='Zero carbon electricity'),
        nameKey?: string(name='nameKey', description='Power Type Code', example='carbonInventory.carbonEmissionAnalysis.components.CarbonDetail.lingTanDianLi'),
        ratio?: double(name='ratio', description='Proportion of electricity consumption to all electricity consumption in the month: example value: 0.5 (i. e., 50%)', example='0.5'),
        rawData?: double(name='rawData', description='Electricity consumption', example='3.14'),
        year?: string(name='year', description='Year', example='2024'),
      }
    ](name='zero', description='Zero electricity monthly electricity consumption and carbon emissions and other data.'),
  }(name='data', description='The returned data.'),
  requestId?: string(name='requestId', description='The request ID.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model GetElecTrendResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetElecTrendResponseBody(name='body'),
}

/**
 * @summary This interface is used to obtain power trend analysis data.
 *
 * @param request GetElecTrendRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetElecTrendResponse
 */
async function getElecTrendWithOptions(request: GetElecTrendRequest, headers: map[string]string, runtime: $RuntimeOptions): GetElecTrendResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.yearList)) {
    body['yearList'] = request.yearList;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetElecTrend',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/emission/analysis/elec/trend`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary This interface is used to obtain power trend analysis data.
 *
 * @param request GetElecTrendRequest
 * @return GetElecTrendResponse
 */
async function getElecTrend(request: GetElecTrendRequest): GetElecTrendResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getElecTrendWithOptions(request, headers, runtime);
}

model GetEmissionSourceConstituteRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='C-20240119-1'),
  moduleCode?: string(name='moduleCode', description='Module code.', example='carbonInventory.check.scope_1_direct_ghg_emissions'),
  moduleType?: int32(name='moduleType', description='Module type.

This parameter is required.', example='3'),
  year?: int32(name='year', description='Year of inventory.

This parameter is required.', example='2024'),
}

model GetEmissionSourceConstituteResponseBody = {
  data?: [
    ConstituteItem
  ](name='data', description='Response parameters'),
  requestId?: string(name='requestId', description='Id of the request', example='9bc20a5a-b26b-4c28-922a-7cd10b61f96f'),
}

model GetEmissionSourceConstituteResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetEmissionSourceConstituteResponseBody(name='body'),
}

/**
 * @summary Obtain the emission source composition.
 *
 * @param request GetEmissionSourceConstituteRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetEmissionSourceConstituteResponse
 */
async function getEmissionSourceConstituteWithOptions(request: GetEmissionSourceConstituteRequest, headers: map[string]string, runtime: $RuntimeOptions): GetEmissionSourceConstituteResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.moduleCode)) {
    body['moduleCode'] = request.moduleCode;
  }
  if (!$isNull(request.moduleType)) {
    body['moduleType'] = request.moduleType;
  }
  if (!$isNull(request.year)) {
    body['year'] = request.year;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetEmissionSourceConstitute',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/emission/analysis/constitute`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Obtain the emission source composition.
 *
 * @param request GetEmissionSourceConstituteRequest
 * @return GetEmissionSourceConstituteResponse
 */
async function getEmissionSourceConstitute(request: GetEmissionSourceConstituteRequest): GetEmissionSourceConstituteResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getEmissionSourceConstituteWithOptions(request, headers, runtime);
}

model GetEmissionSummaryRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='C-20240119-1'),
  moduleCode?: string(name='moduleCode', description='Module code.', example='carbonInventory.check.scope_1_direct_ghg_emissions'),
  moduleType?: int32(name='moduleType', description='Module type.', example='3'),
  year?: int32(name='year', description='Year of inventory.

This parameter is required.', example='2024'),
}

model GetEmissionSummaryResponseBody = {
  data?: {
    actualEmissionRatio?: double(name='actualEmissionRatio', description='Percentage of scheduled.', example='2.7657'),
    carbonSaveConversion?: double(name='carbonSaveConversion', description='Carbon emissions reduction.', example='0.0'),
    currentPeriodCarbonEmissionData?: double(name='currentPeriodCarbonEmissionData', description='Statistical indicators for this cycle.', example='276.4'),
    isWeighting?: boolean(name='isWeighting', description='Whether to show the weighting ratio carbon emission.', example='true'),
    lastPeriodCarbonEmissionData?: double(name='lastPeriodCarbonEmissionData', description='Last period statistical indicators.', example='9.40100'),
    lastPeriodWeightingCarbonEmissionData?: double(name='lastPeriodWeightingCarbonEmissionData', description='Calculation of carbon emissions based on shareholding ratio in the last cycle.', example='8.4609'),
    ratio?: double(name='ratio', description='Year-on-year.', example='28.410'),
    totalCarbonEmissionData?: double(name='totalCarbonEmissionData', description='Total carbon emissions.', example='276.46'),
    weightingCarbonEmissionData?: double(name='weightingCarbonEmissionData', description='Calculate carbon emissions by share ratio', example='248.81400'),
    weightingRatio?: double(name='weightingRatio', description='Year-on-year of weighting ratio carbon emissions.', example='28.4102'),
  }(name='data', description='Details of summarized data'),
  requestId?: string(name='requestId', description='Id of the request.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model GetEmissionSummaryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetEmissionSummaryResponseBody(name='body'),
}

/**
 * @summary Get a summary of carbon emissions.
 *
 * @param request GetEmissionSummaryRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetEmissionSummaryResponse
 */
async function getEmissionSummaryWithOptions(request: GetEmissionSummaryRequest, headers: map[string]string, runtime: $RuntimeOptions): GetEmissionSummaryResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.moduleCode)) {
    body['moduleCode'] = request.moduleCode;
  }
  if (!$isNull(request.moduleType)) {
    body['moduleType'] = request.moduleType;
  }
  if (!$isNull(request.year)) {
    body['year'] = request.year;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetEmissionSummary',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/emission/analysis/summary`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Get a summary of carbon emissions.
 *
 * @param request GetEmissionSummaryRequest
 * @return GetEmissionSummaryResponse
 */
async function getEmissionSummary(request: GetEmissionSummaryRequest): GetEmissionSummaryResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getEmissionSummaryWithOptions(request, headers, runtime);
}

model GetEpdInventoryConstituteRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='C-20080808-1'),
  productId?: long(name='productId', description='The product id.

This parameter is required.', example='1024'),
  productType?: long(name='productType', description='Product type: 1 indicates that the carbon footprint of the product is requested, and 5 indicates that the carbon footprint of the supply chain is requested.

This parameter is required.', example='1'),
}

model GetEpdInventoryConstituteResponseBody = {
  data?: [
    EpdInventoryConstituteItem
  ](name='data', description='List of environmental impact results.'),
  requestId?: string(name='requestId', description='The ID of the request. The value is unique for each request. This facilitates subsequent troubleshooting.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model GetEpdInventoryConstituteResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetEpdInventoryConstituteResponseBody(name='body'),
}

/**
 * @summary Gets the result details of the environmental impact category.
 *
 * @description This API returns the emission amounts for various environmental impact categories at different levels for the given product ID. It helps understand the emission quantities for different environmental impact categories and inventories of the product.
 *
 * @param request GetEpdInventoryConstituteRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetEpdInventoryConstituteResponse
 */
async function getEpdInventoryConstituteWithOptions(request: GetEpdInventoryConstituteRequest, headers: map[string]string, runtime: $RuntimeOptions): GetEpdInventoryConstituteResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.productId)) {
    body['productId'] = request.productId;
  }
  if (!$isNull(request.productType)) {
    body['productType'] = request.productType;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetEpdInventoryConstitute',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/footprint/result/epd/inventory/constitute`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Gets the result details of the environmental impact category.
 *
 * @description This API returns the emission amounts for various environmental impact categories at different levels for the given product ID. It helps understand the emission quantities for different environmental impact categories and inventories of the product.
 *
 * @param request GetEpdInventoryConstituteRequest
 * @return GetEpdInventoryConstituteResponse
 */
async function getEpdInventoryConstitute(request: GetEpdInventoryConstituteRequest): GetEpdInventoryConstituteResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getEpdInventoryConstituteWithOptions(request, headers, runtime);
}

model GetEpdSummaryRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='C-20080808-1'),
  productId?: long(name='productId', description='The product id.

This parameter is required.', example='1024'),
  productType?: long(name='productType', description='Product type: 1 indicates that the carbon footprint of the product is requested, and 5 indicates that the carbon footprint of the supply chain is requested.

This parameter is required.', example='1'),
}

model GetEpdSummaryResponseBody = {
  data?: [ 
    {
      carbonEmission?: double(name='carbonEmission', description='Emissions. The result is maintained up to 31 decimal places for precise intermediate calculation and subsequently truncated for display. It is advised to pair the emissions figure with the unit of the environmental impact result for a comprehensive understanding.', example='1009.976265540000000000000000000000'),
      indicator?: string(name='indicator', description='The evaluation index adopted for the environmental impact', example='GWP100a'),
      key?: string(name='key', description='The category key. The environmental impact category. Currently, a maximum of 19 categories are supported. Enumeration refers to [Carbon Footprint Appendices](https://carbon-doc.oss-cn-hangzhou.aliyuncs.com/CarbonFootprintAppendices-en.pdf).', example='gwp'),
      method?: string(name='method', description='Calculation method standard', example='CML v4.8 2016'),
      name?: string(name='name', description='The name of the category.', example='climate change'),
      num?: long(name='num', description='Category num: the unique serial number of the environmental impact category. A maximum of 19 categories are supported. Enumeration refers to [Carbon Footprint Appendices](https://carbon-doc.oss-cn-hangzhou.aliyuncs.com/CarbonFootprintAppendices-en.pdf).', example='1'),
      preUnit?: string(name='preUnit', description='Environmental impact result Value Unit.', example='kg CO2-Eq'),
      state?: long(name='state', description='The data status. 1 indicates that the calculation is accurate, 2 indicates that the default data is used, and 3 indicates that the missing factor uses the value of 0.', example='1'),
    }
  ](name='data', description='Response parameters'),
  requestId?: string(name='requestId', description='The ID of the request. The value is unique for each request. This facilitates subsequent troubleshooting.', example='B91B5559-065A-55C3-8D75-DA218EBFD1DC'),
}

model GetEpdSummaryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetEpdSummaryResponseBody(name='body'),
}

/**
 * @summary Obtain the total amount of emissions for various environmental impacts.
 *
 * @description This API takes a product ID from the user and returns the summary of environmental impact generated for the product. This info helps understand the overall emissions for different environmental impact categories of the product.
 *
 * @param request GetEpdSummaryRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetEpdSummaryResponse
 */
async function getEpdSummaryWithOptions(request: GetEpdSummaryRequest, headers: map[string]string, runtime: $RuntimeOptions): GetEpdSummaryResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.productId)) {
    body['productId'] = request.productId;
  }
  if (!$isNull(request.productType)) {
    body['productType'] = request.productType;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetEpdSummary',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/footprint/result/epd/summary`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Obtain the total amount of emissions for various environmental impacts.
 *
 * @description This API takes a product ID from the user and returns the summary of environmental impact generated for the product. This info helps understand the overall emissions for different environmental impact categories of the product.
 *
 * @param request GetEpdSummaryRequest
 * @return GetEpdSummaryResponse
 */
async function getEpdSummary(request: GetEpdSummaryRequest): GetEpdSummaryResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getEpdSummaryWithOptions(request, headers, runtime);
}

model GetFootprintListRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='C-20080808-1'),
  currentPage?: long(name='currentPage', description='The pagination parameter. The number of the page that starts from 1.

This parameter is required.', example='1'),
  pageSize?: long(name='pageSize', description='The number of entries returned on each page.

This parameter is required.', example='10'),
  productType?: long(name='productType', description='Product type: 1 indicates that the carbon footprint of the product is requested, and 5 indicates that the carbon footprint of the supply chain is requested.

This parameter is required.', example='1'),
}

model GetFootprintListResponseBody = {
  data?: {
    currentPage?: long(name='currentPage', description='The page number.', example='1'),
    pageSize?: long(name='pageSize', description='The number of entries returned on each page.', example='10'),
    records?: [ 
      {
        amount?: double(name='amount', description='The amount of the product.', example='100.0000000000000000000000000'),
        authStatus?: long(name='authStatus', description='Authentication status enumeration value, please refer to [link](https://carbon-doc.oss-cn-hangzhou.aliyuncs.com/CarbonFootprintAppendices-en.pdf).', example='1'),
        checkEndTime?: string(name='checkEndTime', description='Calculation end time.', example='2024/01/31'),
        checkStartTime?: string(name='checkStartTime', description='Calculation start time.', example='2024/01/01'),
        code?: string(name='code', description='The enterprise code.', example='C-20080808-1'),
        createdBy?: string(name='createdBy', description='The user who created it.', example='Energy Expert'),
        id?: long(name='id', description='The product ID.', example='1024'),
        isDemoModel?: long(name='isDemoModel', description='Indicates whether the demo model is a built-in model. A value of 1 indicates a true value and a value of 0 indicates a false value.', example='1'),
        lifeCycle?: string(name='lifeCycle', description='The literal expression corresponding to lifeCycleType, `From Cradle to Gate` and `From Cradle to Grave`.', example='From Cradle to Gate'),
        lifeCycleType?: long(name='lifeCycleType', description='1 is `From Cradle to Gate`, and 2 is `From Cradle to Grave`.', example='1'),
        name?: string(name='name', description='The product name.', example='Carbon-footprint-demo'),
        type?: string(name='type', description='Product category enumeration value, please refer to [Carbon Footprint Appendices](https://carbon-doc.oss-cn-hangzhou.aliyuncs.com/CarbonFootprintAppendices-en.pdf).', example='158-159'),
        unit?: string(name='unit', description='Unit enumeration value. Please refer to [Carbon Footprint Appendices](https://carbon-doc.oss-cn-hangzhou.aliyuncs.com/CarbonFootprintAppendices-en.pdf).', example='1-4'),
      }
    ](name='records', description='Product Detail List.'),
    total?: long(name='total', description='The total number of entries returned.', example='21'),
    totalPage?: long(name='totalPage', description='Total Pages', example='3'),
  }(name='data', description='The response parameters.'),
  requestId?: string(name='requestId', description='The ID of the request. The value is unique for each request. This facilitates subsequent troubleshooting.', example='06DA2909-7736-5738-AA31-ACD617D828F1'),
}

model GetFootprintListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetFootprintListResponseBody(name='body'),
}

/**
 * @summary Get the list of product carbon footprints.
 *
 * @description With user-specified parameters such as enterprise code, current page, and page size, this API returns a list of matching product carbon footprints (or supply chain carbon footprints), including product names and product IDs. The product ID can be used as input parameters in other APIs to get the corresponding product\\"s detailed information.
 *
 * @param request GetFootprintListRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetFootprintListResponse
 */
async function getFootprintListWithOptions(request: GetFootprintListRequest, headers: map[string]string, runtime: $RuntimeOptions): GetFootprintListResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.currentPage)) {
    body['currentPage'] = request.currentPage;
  }
  if (!$isNull(request.pageSize)) {
    body['pageSize'] = request.pageSize;
  }
  if (!$isNull(request.productType)) {
    body['productType'] = request.productType;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetFootprintList',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/footprint/product/list`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Get the list of product carbon footprints.
 *
 * @description With user-specified parameters such as enterprise code, current page, and page size, this API returns a list of matching product carbon footprints (or supply chain carbon footprints), including product names and product IDs. The product ID can be used as input parameters in other APIs to get the corresponding product\\"s detailed information.
 *
 * @param request GetFootprintListRequest
 * @return GetFootprintListResponse
 */
async function getFootprintList(request: GetFootprintListRequest): GetFootprintListResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getFootprintListWithOptions(request, headers, runtime);
}

model GetGasConstituteRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='C-20240115-3'),
  moduleCode?: string(name='moduleCode', description='Module code.', example='carbonInventory.check.scope_1_direct_ghg_emissions'),
  moduleType?: int32(name='moduleType', description='Module type.

This parameter is required.', example='3'),
  year?: int32(name='year', description='Year

This parameter is required.', example='2024'),
}

model GetGasConstituteResponseBody = {
  data?: [ 
    {
      carbonEmissionData?: double(name='carbonEmissionData', description='Carbon emissions', example='3.14'),
      gasEmissionData?: double(name='gasEmissionData', description='Gas emissions', example='3.14'),
      name?: string(name='name', description='Name of gas', example='CO₂'),
      ratio?: double(name='ratio', description='Proportion of carbon emissions. Example value: 0.5 (50%)', example='0.5'),
      type?: int32(name='type', description='Gas Type', example='1'),
    }
  ](name='data', description='The data returned.'),
  requestId?: string(name='requestId', description='The request ID.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model GetGasConstituteResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetGasConstituteResponseBody(name='body'),
}

/**
 * @summary This interface is used to obtain gas composition analysis.
 *
 * @param request GetGasConstituteRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetGasConstituteResponse
 */
async function getGasConstituteWithOptions(request: GetGasConstituteRequest, headers: map[string]string, runtime: $RuntimeOptions): GetGasConstituteResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.moduleCode)) {
    body['moduleCode'] = request.moduleCode;
  }
  if (!$isNull(request.moduleType)) {
    body['moduleType'] = request.moduleType;
  }
  if (!$isNull(request.year)) {
    body['year'] = request.year;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetGasConstitute',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/emission/analysis/gas/constitute`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary This interface is used to obtain gas composition analysis.
 *
 * @param request GetGasConstituteRequest
 * @return GetGasConstituteResponse
 */
async function getGasConstitute(request: GetGasConstituteRequest): GetGasConstituteResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getGasConstituteWithOptions(request, headers, runtime);
}

model GetGwpBenchmarkListRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='C-20080808-1'),
  productId?: long(name='productId', description='The product id.

This parameter is required.', example='1024'),
  productType?: long(name='productType', description='Product type: 1 indicates that the carbon footprint of the product is requested, and 5 indicates that the carbon footprint of the supply chain is requested.

This parameter is required.', example='1'),
}

model GetGwpBenchmarkListResponseBody = {
  data?: {
    items?: [ 
      {
        activeReduction?: double(name='activeReduction', description='`activeReduction=benchmarkEmission-carbonEmission` Generally, baseline emissions are greater than inventory emissions. Maintain four decimal places. Unit pertains to a higher-level unit.', example='0.2169'),
        benchmarkEmission?: double(name='benchmarkEmission', description='Benchmark emissions. Maintain four decimal places. Unit pertains to a higher-level unit.', example='0.0108'),
        benchmarkName?: string(name='benchmarkName', description='Benchmark name', example='old-energy'),
        carbonEmission?: double(name='carbonEmission', description='Inventory emissions. Maintain four decimal places. Unit pertains to a higher-level unit.', example='-0.2061'),
        name?: string(name='name', description='name', example='new-energy'),
        percent?: string(name='percent', description='Unused temporarily.', example='null'),
      }
    ](name='items', description='Active carbon reduction ranking list.'),
    unit?: string(name='unit', description='unit of emissions. The default value is `kgCO₂e/productUnit`. 
The `productUnit` is the unit selected for the product. The unit value is changed to `tCO₂e/productUnit` or `gCO₂e/productUnit`. For more information, see the remarks in the quantity column.', example='kgCO₂e/kg'),
  }(name='data', description='The response parameters.'),
  requestId?: string(name='requestId', description='The ID of the request. The value is unique for each request. This facilitates subsequent troubleshooting.', example='A8AEC6D9-A359-5169-BD1A-BD848BA60D65'),
}

model GetGwpBenchmarkListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetGwpBenchmarkListResponseBody(name='body'),
}

/**
 * @summary obtain the active carbon reduction ranking list.
 *
 * @description This interface returns a list of proactive carbon reduction information given product ID. It\\"s used to understand the carbon reduction efforts at various levels of the product.
 *
 * @param request GetGwpBenchmarkListRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetGwpBenchmarkListResponse
 */
async function getGwpBenchmarkListWithOptions(request: GetGwpBenchmarkListRequest, headers: map[string]string, runtime: $RuntimeOptions): GetGwpBenchmarkListResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.productId)) {
    body['productId'] = request.productId;
  }
  if (!$isNull(request.productType)) {
    body['productType'] = request.productType;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetGwpBenchmarkList',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/footprint/result/gwp/benchmark/list`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary obtain the active carbon reduction ranking list.
 *
 * @description This interface returns a list of proactive carbon reduction information given product ID. It\\"s used to understand the carbon reduction efforts at various levels of the product.
 *
 * @param request GetGwpBenchmarkListRequest
 * @return GetGwpBenchmarkListResponse
 */
async function getGwpBenchmarkList(request: GetGwpBenchmarkListRequest): GetGwpBenchmarkListResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getGwpBenchmarkListWithOptions(request, headers, runtime);
}

model GetGwpBenchmarkSummaryRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='C-20080808-1'),
  productId?: long(name='productId', description='The product id.

This parameter is required.', example='1024'),
  productType?: long(name='productType', description='Product type: 1 indicates that the carbon footprint of the product is requested, and 5 indicates that the carbon footprint of the supply chain is requested.

This parameter is required.', example='1'),
}

model GetGwpBenchmarkSummaryResponseBody = {
  data?: {
    items?: [ 
      {
        name?: string(name='name', description='Name of carbon reduction details.', example='Energy-Replacement'),
        percent?: string(name='percent', description='Percentage of emissions. The value is of the string type. Two decimal places are reserved for numbers. For example, "99.01" indicates the 99.01% of this type of emissions to the total emissions. Note that the returned string itself does not contain a percent sign.', example='99.01'),
        quantity?: long(name='quantity', description='Emission amount is presented with four decimal places. Normally, modeling doesn\\\\"t result in negative values, but users can represent carbon reductions as negatives. The amount, paired with the unit, defines the emissions. Both are dynamically adjusted. If emissions exceed `1000 kgCO₂e/productUnit`, they convert to `tCO₂e/productUnit`. If they fall below `1 kgCO₂e/productUnit`, they convert to `gCO₂e/productUnit`. Otherwise, they stay in `kgCO₂e/productUnit`.', example='9.9763'),
        unit?: string(name='unit', description='Unit of emissions. The default value is `kgCO₂e/productUnit.` `productUnit` is the unit selected for the product. The unit value is changed to `tCO₂e/productUnit` or `gCO₂e/productUnit`. For more information, see the remarks in the quantity column.', example='kgCO₂e/kg'),
      }
    ](name='items', description='Carbon Reduction Contribution Top4 Details.'),
    quantity?: long(name='quantity', description='Emission amount is presented with four decimal places. Normally, modeling doesn\\\\"t result in negative values, but users can represent carbon reductions as negatives. The amount, paired with the unit, defines the emissions. Both are dynamically adjusted. If emissions exceed `1000 kgCO₂e/productUnit`, they convert to `tCO₂e/productUnit`. If they fall below `1 kgCO₂e/productUnit`, they convert to `gCO₂e/productUnit`. Otherwise, they stay in `kgCO₂e/productUnit`.', example='1000.0000'),
    unit?: string(name='unit', description='Unit of emissions. The default value is `kgCO₂e/productUnit.` `productUnit` is the unit selected for the product. The unit value is changed to `tCO₂e/productUnit` or `gCO₂e/productUnit`. For more information, see the remarks in the quantity column.', example='kgCO₂e/t'),
  }(name='data', description='The response parameters.'),
  requestId?: string(name='requestId', description='The ID of the request. The value is unique for each request. This facilitates subsequent troubleshooting.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model GetGwpBenchmarkSummaryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetGwpBenchmarkSummaryResponseBody(name='body'),
}

/**
 * @summary This API is to obtain the total amount of active carbon reduction.
 *
 * @description The API takes a product ID and returns data on the carbon emissions reduction along with a list of the top four contributors to carbon reduction. This info helps understand the total carbon reduction of the product and its main sources.
 *
 * @param request GetGwpBenchmarkSummaryRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetGwpBenchmarkSummaryResponse
 */
async function getGwpBenchmarkSummaryWithOptions(request: GetGwpBenchmarkSummaryRequest, headers: map[string]string, runtime: $RuntimeOptions): GetGwpBenchmarkSummaryResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.productId)) {
    body['productId'] = request.productId;
  }
  if (!$isNull(request.productType)) {
    body['productType'] = request.productType;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetGwpBenchmarkSummary',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/footprint/result/gwp/benchmark/summary`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary This API is to obtain the total amount of active carbon reduction.
 *
 * @description The API takes a product ID and returns data on the carbon emissions reduction along with a list of the top four contributors to carbon reduction. This info helps understand the total carbon reduction of the product and its main sources.
 *
 * @param request GetGwpBenchmarkSummaryRequest
 * @return GetGwpBenchmarkSummaryResponse
 */
async function getGwpBenchmarkSummary(request: GetGwpBenchmarkSummaryRequest): GetGwpBenchmarkSummaryResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getGwpBenchmarkSummaryWithOptions(request, headers, runtime);
}

model GetGwpInventoryConstituteRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='C-20080808-1'),
  productId?: long(name='productId', description='The product id.

This parameter is required.', example='1024'),
  productType?: long(name='productType', description='Product type: 1 indicates that the carbon footprint of the product is requested, and 5 indicates that the carbon footprint of the supply chain is requested.

This parameter is required.', example='1'),
}

model GetGwpInventoryConstituteResponseBody = {
  data?: {
    byResourceType?: [
      GwpInventoryConstitute
    ](name='byResourceType', description='Aggregated by resource type of an inventory.'),
    carbonEmission?: double(name='carbonEmission', description='Emission quantity: may be positive, negative, or 0. To ensure the calculation accuracy, 24 decimal places are reserved for the calculation process. We recommend that you intercept data based on your business requirements.', example='1009.976265540000000000000000000000'),
    items?: [
      GwpInventoryConstitute
    ](name='items', description='Organized by hierarchy from high to low, according to the flow-> process-> inventory hierarchy.'),
    name?: string(name='name', description='The name.', example='This is not used for displaying'),
    unit?: string(name='unit', description='Emission Unit.', example='kgCO₂e/t'),
  }(name='data', description='The response parameters.'),
  requestId?: string(name='requestId', description='The ID of the request. The value is unique for each request. This facilitates subsequent troubleshooting.', example='06DA2909-7736-5738-AA31-ACD617D828F1'),
}

model GetGwpInventoryConstituteResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetGwpInventoryConstituteResponseBody(name='body'),
}

/**
 * @summary Used to obtain the carbon emission composition analysis of a specified product. Carbon emission composition analysis includes two analysis dimensions: inventory and type. In the rendering effect, including a hierarchical list and pie chart.
 *
 * @description Used to obtain the carbon emission composition analysis of a specified product. Carbon emission composition analysis includes two analysis dimensions: inventory and type. In the rendering effect, including a hierarchical list and pie chart.
 *
 * @param request GetGwpInventoryConstituteRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetGwpInventoryConstituteResponse
 */
async function getGwpInventoryConstituteWithOptions(request: GetGwpInventoryConstituteRequest, headers: map[string]string, runtime: $RuntimeOptions): GetGwpInventoryConstituteResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.productId)) {
    body['productId'] = request.productId;
  }
  if (!$isNull(request.productType)) {
    body['productType'] = request.productType;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetGwpInventoryConstitute',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/footprint/result/gwp/inventory/constitute`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Used to obtain the carbon emission composition analysis of a specified product. Carbon emission composition analysis includes two analysis dimensions: inventory and type. In the rendering effect, including a hierarchical list and pie chart.
 *
 * @description Used to obtain the carbon emission composition analysis of a specified product. Carbon emission composition analysis includes two analysis dimensions: inventory and type. In the rendering effect, including a hierarchical list and pie chart.
 *
 * @param request GetGwpInventoryConstituteRequest
 * @return GetGwpInventoryConstituteResponse
 */
async function getGwpInventoryConstitute(request: GetGwpInventoryConstituteRequest): GetGwpInventoryConstituteResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getGwpInventoryConstituteWithOptions(request, headers, runtime);
}

model GetGwpInventorySummaryRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='C-20080808-1'),
  productId?: long(name='productId', description='The product id.

This parameter is required.', example='1024'),
  productType?: long(name='productType', description='Product type: 1 indicates that the carbon footprint of the product is requested, and 5 indicates that the carbon footprint of the supply chain is requested.

This parameter is required.', example='1'),
}

model GetGwpInventorySummaryResponseBody = {
  data?: {
    items?: [ 
      {
        name?: string(name='name', description='Inventory resource type name.', example='Energy'),
        percent?: string(name='percent', description='Percentage.', example='99.01'),
        quantity?: double(name='quantity', description='Quantity.', example='9.9763'),
        unit?: string(name='unit', description='The unit.', example='kgCO₂e/Piece(s)'),
      }
    ](name='items', description='Top 4 types of carbon footprint contribution.'),
    quantity?: double(name='quantity', description='The emission quantity.', example='1.0100'),
    resultGenerateTime?: long(name='resultGenerateTime', description='The time when the result was generated, in the millisecond timestamp format.', example='1709108026000'),
    unit?: string(name='unit', description='Emission Unit.', example='tCO₂e/Piece(s)'),
  }(name='data', description='The returned results.'),
  requestId?: string(name='requestId', description='The ID of the request. The value is unique for each request. This facilitates subsequent troubleshooting.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model GetGwpInventorySummaryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetGwpInventorySummaryResponseBody(name='body'),
}

/**
 * @summary This API is used to obtain the total carbon footprint of a product and the top four types of carbon footprint contribution.
 *
 * @description Returns the total carbon footprint data for the user-specified product ID, along with details on the top four contributors to the carbon footprint, helping to understand the overall carbon footprint and its main components.
 *
 * @param request GetGwpInventorySummaryRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetGwpInventorySummaryResponse
 */
async function getGwpInventorySummaryWithOptions(request: GetGwpInventorySummaryRequest, headers: map[string]string, runtime: $RuntimeOptions): GetGwpInventorySummaryResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.productId)) {
    body['productId'] = request.productId;
  }
  if (!$isNull(request.productType)) {
    body['productType'] = request.productType;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetGwpInventorySummary',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/footprint/result/gwp/inventory/summary`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary This API is used to obtain the total carbon footprint of a product and the top four types of carbon footprint contribution.
 *
 * @description Returns the total carbon footprint data for the user-specified product ID, along with details on the top four contributors to the carbon footprint, helping to understand the overall carbon footprint and its main components.
 *
 * @param request GetGwpInventorySummaryRequest
 * @return GetGwpInventorySummaryResponse
 */
async function getGwpInventorySummary(request: GetGwpInventorySummaryRequest): GetGwpInventorySummaryResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getGwpInventorySummaryWithOptions(request, headers, runtime);
}

model GetInventoryListRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='C-20080808-1'),
  emissionType?: string(name='emissionType', description='Type of emission

>  Valid values: footprint | emission. Meaning: footprint: all inventories are involved in the calculation; emission: only inventories with positive and zero emissions are involved in the calculation, and negative numbers are not involved in the calculation.

This parameter is required.', example='footprint'),
  group?: string(name='group', description='Group by

>  Valid values: resource | process | resourceType | processType. Meaning: resource: aggregation by inventory group, process: aggregation by operation group, resourceType: aggregation by inventory type, processType: aggregation by phase group

This parameter is required.', example='resource'),
  methodType?: string(name='methodType', description='The type of the obtained environmental impact: gwp indicates the carbon footprint of climate change. 
<props="intl">[For more information, see the environment impact category enumeration.](https://www.alibabacloud.com/help/en/energy-expert/developer-reference/enumerated-values-of-energy-expert#RhGn7)

This parameter is required.', example='gwp'),
  productId?: long(name='productId', description='The product id.

This parameter is required.', example='1024'),
  productType?: long(name='productType', description='Product type: 1 indicates that the carbon footprint of the product is requested, and 5 indicates that the carbon footprint of the supply chain is requested.

This parameter is required.', example='1'),
}

model GetInventoryListResponseBody = {
  data?: {
    items?: [ 
      {
        carbonEmission?: double(name='carbonEmission', description='Emission quantity: may be positive, negative, or 0. To ensure the calculation accuracy, 24 decimal places are reserved for the calculation process. We recommend that you intercept data based on your business requirements.', example='1000.000000000000000000000000000000'),
        name?: string(name='name', description='Name 

> The name is related to the request parameters group. Request parameters: resource, return name parameter meaning: list name; request parameters: process, return name parameter meaning: process name; request parameters: resourceType, return name parameter meaning: inventory resource type name; request parameters: processType, return name parameter meaning: flow name.', example='Energy'),
        percent?: string(name='percent', description='Percentage', example='99.01'),
        processName?: string(name='processName', description='Process Name: It is only meaningful when the request parameters group is resource.', example='Process-1'),
      }
    ](name='items', description='Inventory detail.'),
    productUnit?: string(name='productUnit', description='Unit of product.', example='kg'),
    unit?: string(name='unit', description='Emission Unit: The default value is kgCO₂ /productUnit. productUnit is the unit selected for the product. The unit value is changed to tCO₂ e/productUnit or gCO₂ e/productUnit based on the emission quantity. For more information, see the quantity column.', example='kgCO₂e/kg'),
  }(name='data', description='The response parameters.'),
  requestId?: string(name='requestId', description='The ID of the request. The value is unique for each request. This facilitates subsequent troubleshooting.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model GetInventoryListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetInventoryListResponseBody(name='body'),
}

/**
 * @summary Get the list of emissions in descending order under the specified environmental impact (methodType), specified aggregate level (group), and specified calculation mode (emissionType).
 *
 * @description This interface retrieves a descending order list of emissions for a specified product ID, environmental impact method, group level, and calculation method. It\\"s used to understand various environmental impact emission scenarios.
 *
 * @param request GetInventoryListRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetInventoryListResponse
 */
async function getInventoryListWithOptions(request: GetInventoryListRequest, headers: map[string]string, runtime: $RuntimeOptions): GetInventoryListResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.emissionType)) {
    body['emissionType'] = request.emissionType;
  }
  if (!$isNull(request.group)) {
    body['group'] = request.group;
  }
  if (!$isNull(request.methodType)) {
    body['methodType'] = request.methodType;
  }
  if (!$isNull(request.productId)) {
    body['productId'] = request.productId;
  }
  if (!$isNull(request.productType)) {
    body['productType'] = request.productType;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetInventoryList',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/footprint/result/inventory/list`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Get the list of emissions in descending order under the specified environmental impact (methodType), specified aggregate level (group), and specified calculation mode (emissionType).
 *
 * @description This interface retrieves a descending order list of emissions for a specified product ID, environmental impact method, group level, and calculation method. It\\"s used to understand various environmental impact emission scenarios.
 *
 * @param request GetInventoryListRequest
 * @return GetInventoryListResponse
 */
async function getInventoryList(request: GetInventoryListRequest): GetInventoryListResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getInventoryListWithOptions(request, headers, runtime);
}

model GetOrgAndFactoryResponseBody = {
  code?: string(name='code', description='The code returned for the request.', example='Success'),
  data?: [ 
    {
      aliyunPk?: string(name='aliyunPk', description='The Alibaba Cloud account ID.', example='1319617584664960'),
      factoryList?: [ 
        {
          factoryId?: string(name='factoryId', description='The site ID.', example='pn_95'),
          factoryName?: string(name='factoryName', description='The site name.', example='Ledi Industrial Park 1'),
        }
      ](name='factoryList', description='The sites.'),
      organizationId?: string(name='organizationId', description='The enterprise ID.', example='6265f42XXXX2fec150'),
      organizationName?: string(name='organizationName', description='The enterprise name.', example='Ledi Industrial Park'),
    }
  ](name='data', description='data'),
  httpCode?: int32(name='httpCode', description='The HTTP status code.', example='200'),
  requestId?: string(name='requestId', description='The request ID.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='True'),
}

model GetOrgAndFactoryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetOrgAndFactoryResponseBody(name='body'),
}

/**
 * @summary Queries the organizations and sites that are activated by using an Alibaba Cloud account. You cannot call this operation to query the organizations or sites that have not been activated in the console.
 *
 * @description *   If an activated site exists, the information about the site and the organization to which the site belongs is returned. If no activated site exists, null is returned.
 * - By current, endpoint only supports Hangzhou: `energyexpertexternal.cn-hangzhou.aliyuncs.com`.
 * - To use this API, you need to be added to the whitelist. Please contact us through  <props="china">[official website](https://energy.aliyun.com/ifa/web/defaultLoginPage?adapter=aliyun#/consult?source=%E8%83%BD%E8%80%97%E5%AE%9D%E7%99%BB%E5%BD%95%E9%A1%B5%EF%BC%88WEB%EF%BC%89) 
 * <props="intl">[official website](https://energy.alibabacloud.com/common?adapter=aliyun&lang=en-US#/home/en) to apply for whitelist activation.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetOrgAndFactoryResponse
 */
async function getOrgAndFactoryWithOptions(headers: map[string]string, runtime: $RuntimeOptions): GetOrgAndFactoryResponse {
  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApiUtil.Params{
    action = 'GetOrgAndFactory',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/external/getOrgAndFactory`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the organizations and sites that are activated by using an Alibaba Cloud account. You cannot call this operation to query the organizations or sites that have not been activated in the console.
 *
 * @description *   If an activated site exists, the information about the site and the organization to which the site belongs is returned. If no activated site exists, null is returned.
 * - By current, endpoint only supports Hangzhou: `energyexpertexternal.cn-hangzhou.aliyuncs.com`.
 * - To use this API, you need to be added to the whitelist. Please contact us through  <props="china">[official website](https://energy.aliyun.com/ifa/web/defaultLoginPage?adapter=aliyun#/consult?source=%E8%83%BD%E8%80%97%E5%AE%9D%E7%99%BB%E5%BD%95%E9%A1%B5%EF%BC%88WEB%EF%BC%89) 
 * <props="intl">[official website](https://energy.alibabacloud.com/common?adapter=aliyun&lang=en-US#/home/en) to apply for whitelist activation.
 *
 * @return GetOrgAndFactoryResponse
 */
async function getOrgAndFactory(): GetOrgAndFactoryResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getOrgAndFactoryWithOptions(headers, runtime);
}

model GetOrgConstituteRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='Z-20240115-2'),
  moduleCode?: string(name='moduleCode', description='Module code.', example='carbonInventory.check.scope_1_direct_ghg_emissions'),
  moduleType?: int32(name='moduleType', description='Module type.

This parameter is required.', example='3'),
  year?: int32(name='year', description='Year.

This parameter is required.', example='2024'),
}

model GetOrgConstituteResponseBody = {
  data?: OrgEmission(name='data', description='The data returned.'),
  requestId?: string(name='requestId', description='The request ID.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model GetOrgConstituteResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetOrgConstituteResponseBody(name='body'),
}

/**
 * @summary This interface is used to obtain carbon inventory organization analysis data.
 *
 * @param request GetOrgConstituteRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetOrgConstituteResponse
 */
async function getOrgConstituteWithOptions(request: GetOrgConstituteRequest, headers: map[string]string, runtime: $RuntimeOptions): GetOrgConstituteResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.moduleCode)) {
    body['moduleCode'] = request.moduleCode;
  }
  if (!$isNull(request.moduleType)) {
    body['moduleType'] = request.moduleType;
  }
  if (!$isNull(request.year)) {
    body['year'] = request.year;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetOrgConstitute',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/emission/analysis/org`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary This interface is used to obtain carbon inventory organization analysis data.
 *
 * @param request GetOrgConstituteRequest
 * @return GetOrgConstituteResponse
 */
async function getOrgConstitute(request: GetOrgConstituteRequest): GetOrgConstituteResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getOrgConstituteWithOptions(request, headers, runtime);
}

model GetPcrInfoRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='C-20080808-1'),
  productId?: string(name='productId', description='The product id.

This parameter is required.', example='1024'),
  productType?: long(name='productType', description='Product type: 1 indicates that the carbon footprint of the product is requested, and 5 indicates that the carbon footprint of the supply chain is requested.

This parameter is required.', example='1'),
}

model GetPcrInfoResponseBody = {
  data?: {
    createTime?: string(name='createTime', description='The timestamp when the report was created. The timestamp is in milliseconds.', example='1709109790532'),
    name?: string(name='name', description='Report name', example='report name'),
    url?: string(name='url', description='Download url link.', example='https://energy.alibabacloud.com'),
  }(name='data', description='The response parameters.'),
  requestId?: string(name='requestId', description='The ID of the request. The value is unique for each request. This facilitates subsequent troubleshooting.', example='4A0AEC56-5C9A-5D47-93DF-7227836FFF82'),
}

model GetPcrInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetPcrInfoResponseBody(name='body'),
}

/**
 * @summary Obtains the oss address of the Product Carbon footprint Report.
 *
 * @description With the user-specified product ID, this interface retrieves detailed information and download links for previously generated PCR reports. To use it, two conditions must be met: 1) the result has already been generated; 2) the PCR report has been created.
 *
 * @param request GetPcrInfoRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetPcrInfoResponse
 */
async function getPcrInfoWithOptions(request: GetPcrInfoRequest, headers: map[string]string, runtime: $RuntimeOptions): GetPcrInfoResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.productId)) {
    body['productId'] = request.productId;
  }
  if (!$isNull(request.productType)) {
    body['productType'] = request.productType;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetPcrInfo',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/footprint/result/pcr/detail`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Obtains the oss address of the Product Carbon footprint Report.
 *
 * @description With the user-specified product ID, this interface retrieves detailed information and download links for previously generated PCR reports. To use it, two conditions must be met: 1) the result has already been generated; 2) the PCR report has been created.
 *
 * @param request GetPcrInfoRequest
 * @return GetPcrInfoResponse
 */
async function getPcrInfo(request: GetPcrInfoRequest): GetPcrInfoResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getPcrInfoWithOptions(request, headers, runtime);
}

model GetReductionProposalRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='C-20080808-1'),
  dataQualityEvaluationType?: int32(name='dataQualityEvaluationType', description='The type of the data quality evaluation. 1 is DQI and 2 is DQR.

This parameter is required.', example='1'),
  productId?: long(name='productId', description='The product id.

This parameter is required.', example='1024'),
  productType?: long(name='productType', description='Product type: 1 indicates that the carbon footprint of the product is requested, and 5 indicates that the carbon footprint of the supply chain is requested.

This parameter is required.', example='1'),
}

model GetReductionProposalResponseBody = {
  data?: {
    reduction?: string(name='reduction', description='Proactive carbon reduction recommendations and advice.', example='Reduce one-drop usage'),
    reductionEvaluation?: string(name='reductionEvaluation', description='Active carbon reduction assessment.', example='Trying Energy Expert for a more detailed assessment.'),
  }(name='data', description='The returned data.'),
  requestId?: string(name='requestId', description='The ID of the request. The value is unique for each request. This facilitates subsequent troubleshooting.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model GetReductionProposalResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetReductionProposalResponseBody(name='body'),
}

/**
 * @summary Get carbon reduction recommendations.
 *
 * @description This API returns carbon reduction proposals based on the product ID. It\\"s useful for understanding optimization tips to reduce the carbon emissions associated with a product.
 *
 * @param request GetReductionProposalRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetReductionProposalResponse
 */
async function getReductionProposalWithOptions(request: GetReductionProposalRequest, headers: map[string]string, runtime: $RuntimeOptions): GetReductionProposalResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.dataQualityEvaluationType)) {
    body['dataQualityEvaluationType'] = request.dataQualityEvaluationType;
  }
  if (!$isNull(request.productId)) {
    body['productId'] = request.productId;
  }
  if (!$isNull(request.productType)) {
    body['productType'] = request.productType;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetReductionProposal',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/footprint/result/reduction/proposal`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Get carbon reduction recommendations.
 *
 * @description This API returns carbon reduction proposals based on the product ID. It\\"s useful for understanding optimization tips to reduce the carbon emissions associated with a product.
 *
 * @param request GetReductionProposalRequest
 * @return GetReductionProposalResponse
 */
async function getReductionProposal(request: GetReductionProposalRequest): GetReductionProposalResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getReductionProposalWithOptions(request, headers, runtime);
}

model GetVLExtractionResultRequest {
  taskId?: string(name='taskId', description='- taskID.

- The taskId is obtained from the interfaces SubmitVLExtractionTaskAdvance and SubmitVLExtractionTask.

This parameter is required.', example='1436b6f5-ddea-4308-9d1c-60939e5d5ea8'),
}

model GetVLExtractionResultResponseBody = {
  data?: {
    kvListInfo?: [ 
      {
        context?: {
          confidence?: {
            keyConfidence?: double(name='keyConfidence', description='Confidence of Key', example='0.9994202852249146'),
            valueConfidence?: double(name='valueConfidence', description='Confidence of Value', example='0.9794202852249146'),
          }(name='confidence', description='Confidence'),
          key?: [
            ContentItem
          ](name='key', description='Key recall information details'),
          value?: [
            ContentItem
          ](name='value', description='Value Recall Information'),
        }(name='context', description='Recall content'),
        keyName?: string(name='keyName', description='Field Key name', example='Tenant'),
        keyValue?: string(name='keyValue', description='Field key value', example='Alibaba Cloud XXX Co., Ltd.'),
      }
    ](name='kvListInfo', description='Document Parsing Result'),
  }(name='data', description='Returned Data'),
  requestId?: string(name='requestId', description='Id of the request', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model GetVLExtractionResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetVLExtractionResultResponseBody(name='body'),
}

/**
 * @summary For Querying Qwen-VL Model Information Extraction Results.
 * The input parameter taskId is obtained from the taskId returned by the interfaces SubmitVLExtractionTask or SubmitVLExtractionTaskAdvance.
 * The query results can be in one of three statuses: processing, successfully completed, or failed.
 *
 * @param request GetVLExtractionResultRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetVLExtractionResultResponse
 */
async function getVLExtractionResultWithOptions(request: GetVLExtractionResultRequest, headers: map[string]string, runtime: $RuntimeOptions): GetVLExtractionResultResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.taskId)) {
    body['taskId'] = request.taskId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetVLExtractionResult',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v2/aidoc/document/getVLExtractionResult`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary For Querying Qwen-VL Model Information Extraction Results.
 * The input parameter taskId is obtained from the taskId returned by the interfaces SubmitVLExtractionTask or SubmitVLExtractionTaskAdvance.
 * The query results can be in one of three statuses: processing, successfully completed, or failed.
 *
 * @param request GetVLExtractionResultRequest
 * @return GetVLExtractionResultResponse
 */
async function getVLExtractionResult(request: GetVLExtractionResultRequest): GetVLExtractionResultResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getVLExtractionResultWithOptions(request, headers, runtime);
}

model IsCompletedRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='C-20080808-1'),
  productId?: long(name='productId', description='The product id.

This parameter is required.', example='1024'),
  productType?: long(name='productType', description='Product type: 1 indicates that the carbon footprint of the product is requested, and 5 indicates that the carbon footprint of the supply chain is requested.

This parameter is required.', example='1'),
}

model IsCompletedResponseBody = {
  data?: {
    modifiedTime?: long(name='modifiedTime', description='Modified time in milliseconds, e.g. 1711438780000.', example='1711438780000'),
    taskKey?: string(name='taskKey', description='The unique key of this generation task.', example='550c2b7b-f2e0-4176-ab0a-53ea4b355721'),
    taskShortResult?: string(name='taskShortResult', description='Unused temporarily.', example='null'),
    taskStatus?: string(name='taskStatus', description='The status of the report generation task. The possible values are `running`, `success`, and `error`, which mean generating, generating succeeded, and generating failed, respectively. If you encounter a result generation failure, check the model, correct the model, and then generate the result again.', example='running'),
  }(name='data', description='The response parameters.'),
  requestId?: string(name='requestId', description='The ID of the request. The value is unique for each request. This facilitates subsequent troubleshooting.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model IsCompletedResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: IsCompletedResponseBody(name='body'),
}

/**
 * @summary Check if the result generation is complete.
 *
 * @description This API checks the completion status of generating a report. It should be used before calling other result APIs, as they will only display content once the report generation is complete.
 *
 * @param request IsCompletedRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return IsCompletedResponse
 */
async function isCompletedWithOptions(request: IsCompletedRequest, headers: map[string]string, runtime: $RuntimeOptions): IsCompletedResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.productId)) {
    body['productId'] = request.productId;
  }
  if (!$isNull(request.productType)) {
    body['productType'] = request.productType;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'IsCompleted',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/footprint/result/completed`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Check if the result generation is complete.
 *
 * @description This API checks the completion status of generating a report. It should be used before calling other result APIs, as they will only display content once the report generation is complete.
 *
 * @param request IsCompletedRequest
 * @return IsCompletedResponse
 */
async function isCompleted(request: IsCompletedRequest): IsCompletedResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return isCompletedWithOptions(request, headers, runtime);
}

model PushDeviceDataRequest {
  deviceType?: string(name='deviceType', description='The type of the device. [View device type definitions](https://carbon-doc.oss-cn-hangzhou.aliyuncs.com/Deviceappendixes-en.pdf)

This parameter is required.', example='1'),
  devices?: [ 
    {
      data?: map[string]any(name='data', description='Measuring point information To avoid accuracy problems, the measurement point data is uniformly transmitted to the string. The function of missing required fields cannot be used normally. Some functions may be affected due to the lack of recommend fields. For details, please refer to the notes of equipment measuring points in the appendix. [Reference Point Definition](https://carbon-doc.oss-cn-hangzhou.aliyuncs.com/Deviceappendixes-en.pdf
)

This parameter is required.', example='{
			"dp_imp": "329.0",
			"F": "148.0",
			"eq_imp": "363.0",
			"Ep_imp_1": "128.0",
			"Ep_imp_2": "157.0",
			"Ua": "226.0",
			"Ub": "285.0",
			"Ep_imp": "325.0",
			"Uc": "342.0",
			"Ep_imp_3": "109.0",
			"Ep_imp_4": "94.0",
			"P": "514.0",
			"Pa": "443.0",
			"Q": "265.0",
			"dp_exp": "261.0",
			"eq_exp": "399.0",
			"COSQ": "223.0",
			"Ia": "240.0",
			"Ib": "216.0",
			"Ic": "229.0",
			"Ep_exp": "115.0",
			"VdisPer": "120.0"
		}'),
      deviceId?: string(name='deviceId', description='If the deviceType parameter is set to 12, 13, or 17, you must set the system_id parameter. The field name is still device_id. If the deviceType parameter is set to 15 or 16, no Other situations will be transmitted.

This parameter is required.', example='device_code_xxx'),
      recordTime?: string(name='recordTime', description='Data generation time of measuring point.

This parameter is required.', example='2021-09-08 18:40:00'),
    }
  ](name='devices', description='List of devices to which data is pushed.

This parameter is required.'),
}

model PushDeviceDataResponseBody = {
  data?: string(name='data', description='Whether the data is pushed successfully. Success is returned.', example='success'),
  requestId?: string(name='requestId', description='The request ID.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model PushDeviceDataResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PushDeviceDataResponseBody(name='body'),
}

/**
 * @summary This interface is used to push device measuring point data, such as power meter voltage and other data.
 *
 * @param request PushDeviceDataRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return PushDeviceDataResponse
 */
async function pushDeviceDataWithOptions(request: PushDeviceDataRequest, headers: map[string]string, runtime: $RuntimeOptions): PushDeviceDataResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.deviceType)) {
    body['deviceType'] = request.deviceType;
  }
  if (!$isNull(request.devices)) {
    body['devices'] = request.devices;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'PushDeviceData',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/data/increment/push`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary This interface is used to push device measuring point data, such as power meter voltage and other data.
 *
 * @param request PushDeviceDataRequest
 * @return PushDeviceDataResponse
 */
async function pushDeviceData(request: PushDeviceDataRequest): PushDeviceDataResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return pushDeviceDataWithOptions(request, headers, runtime);
}

model PushItemDataRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='C-20210223-01'),
  items?: {
    code?: string(name='code', description='API data identification.<props="intl">For details: [GetDataItemList ](https://www.alibabacloud.com/help/en/energy-expert/developer-reference/api-energyexpertexternal-2022-09-23-getdataitemlist)

This parameter is required.', example='demo_api_code'),
    month?: string(name='month', description='The month.

This parameter is required.', example='1'),
    value?: double(name='value', description='The value of the data item.

This parameter is required.', example='1.11'),
  }(name='items', description='List of data to be pushed.

This parameter is required.'),
  year?: string(name='year', description='The year of the data created.

This parameter is required.', example='2024'),
}

model PushItemDataResponseBody = {
  data?: boolean(name='data', description='Whether the data is pushed successfully.', example='true'),
  requestId?: string(name='requestId', description='The request ID.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model PushItemDataResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PushItemDataResponseBody(name='body'),
}

/**
 * @summary This interface is used to push data items.
 *
 * @description - This interface is used for individual data item data.
 * - Data items can link data to services such as carbon footprints and carbon inventories.
 * - Depending on the platform configuration, active data on a yearly and monthly basis is supported.
 *
 * @param request PushItemDataRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return PushItemDataResponse
 */
async function pushItemDataWithOptions(request: PushItemDataRequest, headers: map[string]string, runtime: $RuntimeOptions): PushItemDataResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.items)) {
    body['items'] = request.items;
  }
  if (!$isNull(request.year)) {
    body['year'] = request.year;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'PushItemData',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/emission/data/item/push`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary This interface is used to push data items.
 *
 * @description - This interface is used for individual data item data.
 * - Data items can link data to services such as carbon footprints and carbon inventories.
 * - Depending on the platform configuration, active data on a yearly and monthly basis is supported.
 *
 * @param request PushItemDataRequest
 * @return PushItemDataResponse
 */
async function pushItemData(request: PushItemDataRequest): PushItemDataResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return pushItemDataWithOptions(request, headers, runtime);
}

model RecalculateCarbonEmissionRequest {
  code?: string(name='code', description='The enterprise code.

This parameter is required.', example='C-20240202-01'),
  year?: string(name='year', description='Year of inventory.

This parameter is required.', example='2024'),
}

model RecalculateCarbonEmissionResponseBody = {
  data?: boolean(name='data', description='The returned data. A value of true indicates that the request is successful. A value of false indicates that the request fails.', example='true'),
  requestId?: string(name='requestId', description='The request ID.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model RecalculateCarbonEmissionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RecalculateCarbonEmissionResponseBody(name='body'),
}

/**
 * @summary Recalculate carbon emissions.
 *
 * @description - After uploading the data items, you need to call this interface to recalculate the carbon inventory data.
 *
 * @param request RecalculateCarbonEmissionRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return RecalculateCarbonEmissionResponse
 */
async function recalculateCarbonEmissionWithOptions(request: RecalculateCarbonEmissionRequest, headers: map[string]string, runtime: $RuntimeOptions): RecalculateCarbonEmissionResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['code'] = request.code;
  }
  if (!$isNull(request.year)) {
    body['year'] = request.year;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'RecalculateCarbonEmission',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/emission/data/item/recalculate`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Recalculate carbon emissions.
 *
 * @description - After uploading the data items, you need to call this interface to recalculate the carbon inventory data.
 *
 * @param request RecalculateCarbonEmissionRequest
 * @return RecalculateCarbonEmissionResponse
 */
async function recalculateCarbonEmission(request: RecalculateCarbonEmissionRequest): RecalculateCarbonEmissionResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return recalculateCarbonEmissionWithOptions(request, headers, runtime);
}

model SendDocumentAskQuestionRequest {
  folderId?: string(name='folderId', description='Folder ID, used to specify the range of documents for the query. If it is empty, it indicates that all documents under the tenant will be queried.', example='1a851c4a-1d65-11ef-99a7-ssfsfdd'),
  prompt?: string(name='prompt', description='The question queried by the user

This parameter is required.', example='Total carbon emissions in 2023'),
  sessionId?: string(name='sessionId', description='Q&A session ID, used to record multiple Q&A interactions of the same user. If it is empty, it indicates that sessions are not distinguished.', example='bfce2248-1546-4298-8bcf-70ac26e69646'),
}

model SendDocumentAskQuestionResponseBody = {
  data?: {
    answer?: string(name='answer', description='Q&A result', example='Carbon emissions in 2023 totaled 4.681 million tons'),
    document?: [ string ](name='document', description='Documents associated with the answer returned by the query'),
  }(name='data', description='Returned data'),
  requestId?: string(name='requestId', description='Request ID', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model SendDocumentAskQuestionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SendDocumentAskQuestionResponseBody(name='body'),
}

/**
 * @summary Online Document Q\\&A
 *
 * @param request SendDocumentAskQuestionRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return SendDocumentAskQuestionResponse
 */
async function sendDocumentAskQuestionWithOptions(request: SendDocumentAskQuestionRequest, headers: map[string]string, runtime: $RuntimeOptions): SendDocumentAskQuestionResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.folderId)) {
    body['folderId'] = request.folderId;
  }
  if (!$isNull(request.prompt)) {
    body['prompt'] = request.prompt;
  }
  if (!$isNull(request.sessionId)) {
    body['sessionId'] = request.sessionId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'SendDocumentAskQuestion',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/aidoc/document/sendDocumentAskQuestion`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Online Document Q\\&A
 *
 * @param request SendDocumentAskQuestionRequest
 * @return SendDocumentAskQuestionResponse
 */
async function sendDocumentAskQuestion(request: SendDocumentAskQuestionRequest): SendDocumentAskQuestionResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return sendDocumentAskQuestionWithOptions(request, headers, runtime);
}

model SetRunningPlanRequest {
  controlType?: int32(name='controlType', example='0'),
  dateType?: int32(name='dateType', example='0'),
  earliestStartupTime?: string(name='earliestStartupTime', example='05:00:00'),
  endTime?: string(name='endTime', example='2024-07-21'),
  factoryId?: string(name='factoryId', description='This parameter is required.', example='***'),
  latestShutdownTime?: string(name='latestShutdownTime', example='05:30:00'),
  maxCarbonDioxide?: double(name='maxCarbonDioxide', example='2.1'),
  maxTem?: double(name='maxTem', example='3.1'),
  minTem?: double(name='minTem', example='2.1'),
  pKey?: string(name='pKey', example='ib'),
  seasonMode?: int32(name='seasonMode', example='0'),
  startTime?: string(name='startTime', example='2024-07-20'),
  statisticsTime?: string(name='statisticsTime', example='2024-07-31'),
  systemId?: string(name='systemId', description='This parameter is required.', example='system1'),
  workingEndTime?: string(name='workingEndTime', example='05:30:00'),
  workingStartTime?: string(name='workingStartTime', example='05:00:00'),
}

model SetRunningPlanResponseBody = {
  data?: boolean(name='data', example='true'),
  requestId?: string(name='requestId', description='Id of the request', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model SetRunningPlanResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SetRunningPlanResponseBody(name='body'),
}

/**
 * @summary 设置运行计划
 *
 * @param request SetRunningPlanRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return SetRunningPlanResponse
 */
async function setRunningPlanWithOptions(request: SetRunningPlanRequest, headers: map[string]string, runtime: $RuntimeOptions): SetRunningPlanResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.controlType)) {
    body['controlType'] = request.controlType;
  }
  if (!$isNull(request.dateType)) {
    body['dateType'] = request.dateType;
  }
  if (!$isNull(request.earliestStartupTime)) {
    body['earliestStartupTime'] = request.earliestStartupTime;
  }
  if (!$isNull(request.endTime)) {
    body['endTime'] = request.endTime;
  }
  if (!$isNull(request.factoryId)) {
    body['factoryId'] = request.factoryId;
  }
  if (!$isNull(request.latestShutdownTime)) {
    body['latestShutdownTime'] = request.latestShutdownTime;
  }
  if (!$isNull(request.maxCarbonDioxide)) {
    body['maxCarbonDioxide'] = request.maxCarbonDioxide;
  }
  if (!$isNull(request.maxTem)) {
    body['maxTem'] = request.maxTem;
  }
  if (!$isNull(request.minTem)) {
    body['minTem'] = request.minTem;
  }
  if (!$isNull(request.pKey)) {
    body['pKey'] = request.pKey;
  }
  if (!$isNull(request.seasonMode)) {
    body['seasonMode'] = request.seasonMode;
  }
  if (!$isNull(request.startTime)) {
    body['startTime'] = request.startTime;
  }
  if (!$isNull(request.statisticsTime)) {
    body['statisticsTime'] = request.statisticsTime;
  }
  if (!$isNull(request.systemId)) {
    body['systemId'] = request.systemId;
  }
  if (!$isNull(request.workingEndTime)) {
    body['workingEndTime'] = request.workingEndTime;
  }
  if (!$isNull(request.workingStartTime)) {
    body['workingStartTime'] = request.workingStartTime;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'SetRunningPlan',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/carbon/hvac/setRunningPlan`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 设置运行计划
 *
 * @param request SetRunningPlanRequest
 * @return SetRunningPlanResponse
 */
async function setRunningPlan(request: SetRunningPlanRequest): SetRunningPlanResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return setRunningPlanWithOptions(request, headers, runtime);
}

model SubmitDocExtractionTaskRequest {
  extractType?: string(name='extractType', description='Document parsing type:
Supports rag and long text understanding types, default is rag.', example='rag'),
  fileName?: string(name='fileName', description='The filename must include the file type extension.

This parameter is required.', example='example.pdf'),
  fileUrl?: string(name='fileUrl', description='Choose one of fileUrl or fileUrlObject:

- fileUrl: Use by providing the document URL, for a single document (supports up to 1000 pages, 100MB in size)

- fileUrlObject: Use when calling the interface with local file upload, for a single document (supports up to 1000 pages, 100 MB in size)

> The relationship between file parsing methods and supported document types
> - Long text RAG: Supports pdf, doc/docx, up to 1000 pages
> - Image processing: Supports pdf, jpg, jpeg, png, bmp
> - Long text understanding: Supports pdf, doc/docx, xls/xlsx', example='fileUrl：https://example.com/example.pdf
fileUrlObject：FileInputStream generated from a local file'),
  folderId?: string(name='folderId', description='- A unique knowledge base folder ID, used when you need to categorize documents and control the scope of documents for online Q&A queries.
- The folder ID needs to be obtained by logging into the intelligent document console.', example='xxxxx'),
  templateId?: string(name='templateId', description='A unique parsing template ID used to specify the key-value pairs to be extracted from the document. You need to log in to the template management page to configure the template and obtain the corresponding template ID.

This parameter is required.', example='572d24k0c95a'),
}

model SubmitDocExtractionTaskAdvanceRequest {
  extractType?: string(name='extractType', description='Document parsing type:
Supports rag and long text understanding types, default is rag.', example='rag'),
  fileName?: string(name='fileName', description='The filename must include the file type extension.

This parameter is required.', example='example.pdf'),
  fileUrlObject?: readable(name='fileUrl', description='Choose one of fileUrl or fileUrlObject:

- fileUrl: Use by providing the document URL, for a single document (supports up to 1000 pages, 100MB in size)

- fileUrlObject: Use when calling the interface with local file upload, for a single document (supports up to 1000 pages, 100 MB in size)

> The relationship between file parsing methods and supported document types
> - Long text RAG: Supports pdf, doc/docx, up to 1000 pages
> - Image processing: Supports pdf, jpg, jpeg, png, bmp
> - Long text understanding: Supports pdf, doc/docx, xls/xlsx', example='fileUrl：https://example.com/example.pdf
fileUrlObject：FileInputStream generated from a local file'),
  folderId?: string(name='folderId', description='- A unique knowledge base folder ID, used when you need to categorize documents and control the scope of documents for online Q&A queries.
- The folder ID needs to be obtained by logging into the intelligent document console.', example='xxxxx'),
  templateId?: string(name='templateId', description='A unique parsing template ID used to specify the key-value pairs to be extracted from the document. You need to log in to the template management page to configure the template and obtain the corresponding template ID.

This parameter is required.', example='572d24k0c95a'),
}

model SubmitDocExtractionTaskResponseBody = {
  data?: {
    taskId?: string(name='taskId', description='Task ID.', example='864773ec-d35b-4c36-8871-52d07fbe806d'),
  }(name='data', description='Returned data'),
  requestId?: string(name='requestId', description='Request ID.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model SubmitDocExtractionTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SubmitDocExtractionTaskResponseBody(name='body'),
}

/**
 * @summary Extracts key information from documents using user-defined Key-Value or prompt templates. A taskId is returned upon successful execution for retrieving extraction results via GetDocExtractionResult.
 * Supports:
 * URL Upload: SubmitDocExtractionTask
 * Local File Upload: SubmitDocExtractionTask
 *
 * @param request SubmitDocExtractionTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return SubmitDocExtractionTaskResponse
 */
async function submitDocExtractionTaskWithOptions(request: SubmitDocExtractionTaskRequest, headers: map[string]string, runtime: $RuntimeOptions): SubmitDocExtractionTaskResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.extractType)) {
    query['extractType'] = request.extractType;
  }
  if (!$isNull(request.fileName)) {
    query['fileName'] = request.fileName;
  }
  if (!$isNull(request.fileUrl)) {
    query['fileUrl'] = request.fileUrl;
  }
  if (!$isNull(request.folderId)) {
    query['folderId'] = request.folderId;
  }
  if (!$isNull(request.templateId)) {
    query['templateId'] = request.templateId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'SubmitDocExtractionTask',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v2/aidoc/document/submitDocExtractionTask`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Extracts key information from documents using user-defined Key-Value or prompt templates. A taskId is returned upon successful execution for retrieving extraction results via GetDocExtractionResult.
 * Supports:
 * URL Upload: SubmitDocExtractionTask
 * Local File Upload: SubmitDocExtractionTask
 *
 * @param request SubmitDocExtractionTaskRequest
 * @return SubmitDocExtractionTaskResponse
 */
async function submitDocExtractionTask(request: SubmitDocExtractionTaskRequest): SubmitDocExtractionTaskResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return submitDocExtractionTaskWithOptions(request, headers, runtime);
}

async function submitDocExtractionTaskAdvance(request: SubmitDocExtractionTaskAdvanceRequest, headers: map[string]string, runtime: $RuntimeOptions): SubmitDocExtractionTaskResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if($isNull(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if($isNull(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApiUtil.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'energyExpertExternal',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var submitDocExtractionTaskReq = new SubmitDocExtractionTaskRequest{};
  OpenApiUtil.convert(request, submitDocExtractionTaskReq);

  if(!$isNull(request.fileUrlObject)) {
    authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
    ossConfig.accessKeyId = authResponse.body.accessKeyId;
    ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
    ossClient = new OSS(ossConfig);

    fileObj = new FileForm.FileField{
      filename = authResponse.body.objectKey,
      content = request.fileUrlObject,
      contentType = '',
    };
    ossHeader = new OSS.PostObjectRequest.header{
      accessKeyId = authResponse.body.accessKeyId,
      policy = authResponse.body.encodedPolicy,
      signature = authResponse.body.signature,
      key = authResponse.body.objectKey,
      file = fileObj,
      successActionStatus = '201',
    };
    uploadRequest = new OSS.PostObjectRequest{
      bucketName = authResponse.body.bucket,
      header = ossHeader,
    };
    ossClient.postObject(uploadRequest, ossRuntime);
    submitDocExtractionTaskReq.fileUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
  }
  var submitDocExtractionTaskResp = submitDocExtractionTaskWithOptions(submitDocExtractionTaskReq, headers, runtime);
  return submitDocExtractionTaskResp;
}

model SubmitDocParsingTaskRequest {
  fileName?: string(name='fileName', description='The filename must include the file type extension.

This parameter is required.', example='example.pdf'),
  fileUrl?: string(name='fileUrl', description='Choose one of fileUrl or fileUrlObject:

- fileUrl: Use by providing the document URL, for a single document (supports up to 1000 pages and 100MB in size)

- fileUrlObject: Use when calling the interface with local file upload, for a single document (supports up to 1000 pages and 100 MB in size)

> The relationship between file parsing methods and supported document types
> - Long Text RAG: Supports pdf, doc/docx, supports up to 1000 pages
> - Image Processing: Supports pdf, jpg, jpeg, png, bmp
> - Long Text Understanding: Supports pdf, doc/docx, xls/xlsx', example='fileUrl：https://example.com/example.pdf
fileUrlObject：FileInputStream generated from a local file'),
  folderId?: string(name='folderId', description='- Unique knowledge base folder ID, used when categorizing documents and controlling the scope of documents for online Q&A queries.
- The folder ID needs to be obtained from the Intelligent Document Console after logging in.', example='xxxxx'),
  needAnalyzeImg?: boolean(name='needAnalyzeImg', description='Whether to parse image content within the document.', example='false'),
}

model SubmitDocParsingTaskAdvanceRequest {
  fileName?: string(name='fileName', description='The filename must include the file type extension.

This parameter is required.', example='example.pdf'),
  fileUrlObject?: readable(name='fileUrl', description='Choose one of fileUrl or fileUrlObject:

- fileUrl: Use by providing the document URL, for a single document (supports up to 1000 pages and 100MB in size)

- fileUrlObject: Use when calling the interface with local file upload, for a single document (supports up to 1000 pages and 100 MB in size)

> The relationship between file parsing methods and supported document types
> - Long Text RAG: Supports pdf, doc/docx, supports up to 1000 pages
> - Image Processing: Supports pdf, jpg, jpeg, png, bmp
> - Long Text Understanding: Supports pdf, doc/docx, xls/xlsx', example='fileUrl：https://example.com/example.pdf
fileUrlObject：FileInputStream generated from a local file'),
  folderId?: string(name='folderId', description='- Unique knowledge base folder ID, used when categorizing documents and controlling the scope of documents for online Q&A queries.
- The folder ID needs to be obtained from the Intelligent Document Console after logging in.', example='xxxxx'),
  needAnalyzeImg?: boolean(name='needAnalyzeImg', description='Whether to parse image content within the document.', example='false'),
}

model SubmitDocParsingTaskResponseBody = {
  data?: {
    taskId?: string(name='taskId', description='TaskID', example='ae9d07be-1a11-4d30-be75-cc962b98279c'),
  }(name='data', description='Return result.'),
  requestId?: string(name='requestId', description='Request ID.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model SubmitDocParsingTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SubmitDocParsingTaskResponseBody(name='body'),
}

/**
 * @summary Parses text, tables, images, and more from documents. After execution, a taskId is returned for retrieving document parsing results via GetDocParsingResult.
 * Supports:
 * URL Upload: SubmitDocParsingTask
 * Local File Upload: SubmitDocParsingTaskAdvance
 *
 * @param request SubmitDocParsingTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return SubmitDocParsingTaskResponse
 */
async function submitDocParsingTaskWithOptions(request: SubmitDocParsingTaskRequest, headers: map[string]string, runtime: $RuntimeOptions): SubmitDocParsingTaskResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.fileName)) {
    query['fileName'] = request.fileName;
  }
  if (!$isNull(request.fileUrl)) {
    query['fileUrl'] = request.fileUrl;
  }
  if (!$isNull(request.folderId)) {
    query['folderId'] = request.folderId;
  }
  if (!$isNull(request.needAnalyzeImg)) {
    query['needAnalyzeImg'] = request.needAnalyzeImg;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'SubmitDocParsingTask',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v2/aidoc/document/submitDocParsingTask`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Parses text, tables, images, and more from documents. After execution, a taskId is returned for retrieving document parsing results via GetDocParsingResult.
 * Supports:
 * URL Upload: SubmitDocParsingTask
 * Local File Upload: SubmitDocParsingTaskAdvance
 *
 * @param request SubmitDocParsingTaskRequest
 * @return SubmitDocParsingTaskResponse
 */
async function submitDocParsingTask(request: SubmitDocParsingTaskRequest): SubmitDocParsingTaskResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return submitDocParsingTaskWithOptions(request, headers, runtime);
}

async function submitDocParsingTaskAdvance(request: SubmitDocParsingTaskAdvanceRequest, headers: map[string]string, runtime: $RuntimeOptions): SubmitDocParsingTaskResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if($isNull(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if($isNull(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApiUtil.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'energyExpertExternal',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var submitDocParsingTaskReq = new SubmitDocParsingTaskRequest{};
  OpenApiUtil.convert(request, submitDocParsingTaskReq);

  if(!$isNull(request.fileUrlObject)) {
    authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
    ossConfig.accessKeyId = authResponse.body.accessKeyId;
    ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
    ossClient = new OSS(ossConfig);

    fileObj = new FileForm.FileField{
      filename = authResponse.body.objectKey,
      content = request.fileUrlObject,
      contentType = '',
    };
    ossHeader = new OSS.PostObjectRequest.header{
      accessKeyId = authResponse.body.accessKeyId,
      policy = authResponse.body.encodedPolicy,
      signature = authResponse.body.signature,
      key = authResponse.body.objectKey,
      file = fileObj,
      successActionStatus = '201',
    };
    uploadRequest = new OSS.PostObjectRequest{
      bucketName = authResponse.body.bucket,
      header = ossHeader,
    };
    ossClient.postObject(uploadRequest, ossRuntime);
    submitDocParsingTaskReq.fileUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
  }
  var submitDocParsingTaskResp = submitDocParsingTaskWithOptions(submitDocParsingTaskReq, headers, runtime);
  return submitDocParsingTaskResp;
}

model SubmitDocumentAnalyzeJobRequest {
  analysisType?: string(name='analysisType', description='The default extraction method is "doc", with the following optional values:

- vl: Image processing
- doc: Long text RAG (Retrieval-Augmented Generation)
- docUnderstanding: Long text comprehension
- recommender: Recommendation type', example='doc'),
  fileName?: string(name='fileName', description='The filename must include the file type extension.

This parameter is required.', example='example.pdf'),
  fileUrl?: string(name='fileUrl', description='Choose one between fileUrl and fileUrlObject:

- fileUrl: Use the document URL method for a single document (supports documents with up to 1000 pages and within 100MB).

- fileUrlObject: Use when calling the API via local file upload, for a single document (supports documents with up to 1000 pages and 
within 100MB).

> Relationship between file parsing methods and supported document types. 
>- Long Text RAG: Supports pdf, doc/docx, and up to 1000 pages
>- Image Processing: Supports pdf, jpg, jpeg, png, bmp
>- Long Text Understanding: Supports pdf, doc/docx, xls/xlsx', example='https://example.com/example.pdf'),
  folderId?: string(name='folderId', description='Unique knowledge base folder ID, used for categorizing documents and controlling the scope of online Q&A queries. If empty, the document will be uploaded to the tenant\\\\"s root directory.', example='folderCode'),
  templateId?: string(name='templateId', description='The unique extraction template ID is used to specify the key-value pairs to be extracted from the document. You need to log in to the template management page to configure the template and obtain the corresponding template ID.

This parameter is required.', example='templateCode'),
}

model SubmitDocumentAnalyzeJobAdvanceRequest {
  analysisType?: string(name='analysisType', description='The default extraction method is "doc", with the following optional values:

- vl: Image processing
- doc: Long text RAG (Retrieval-Augmented Generation)
- docUnderstanding: Long text comprehension
- recommender: Recommendation type', example='doc'),
  fileName?: string(name='fileName', description='The filename must include the file type extension.

This parameter is required.', example='example.pdf'),
  fileUrlObject?: readable(name='fileUrl', description='Choose one between fileUrl and fileUrlObject:

- fileUrl: Use the document URL method for a single document (supports documents with up to 1000 pages and within 100MB).

- fileUrlObject: Use when calling the API via local file upload, for a single document (supports documents with up to 1000 pages and 
within 100MB).

> Relationship between file parsing methods and supported document types. 
>- Long Text RAG: Supports pdf, doc/docx, and up to 1000 pages
>- Image Processing: Supports pdf, jpg, jpeg, png, bmp
>- Long Text Understanding: Supports pdf, doc/docx, xls/xlsx', example='https://example.com/example.pdf'),
  folderId?: string(name='folderId', description='Unique knowledge base folder ID, used for categorizing documents and controlling the scope of online Q&A queries. If empty, the document will be uploaded to the tenant\\\\"s root directory.', example='folderCode'),
  templateId?: string(name='templateId', description='The unique extraction template ID is used to specify the key-value pairs to be extracted from the document. You need to log in to the template management page to configure the template and obtain the corresponding template ID.

This parameter is required.', example='templateCode'),
}

model SubmitDocumentAnalyzeJobResponseBody = {
  data?: {
    jobId?: string(name='jobId', description='The job ID.', example='adkc-kk2k41-kk2ol-222424'),
  }(name='data', description='The data returned.'),
  requestId?: string(name='requestId', description='Id of the request', example='4A0AEC56-5C9A-5D47-93DF-7227836FFF82'),
}

model SubmitDocumentAnalyzeJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SubmitDocumentAnalyzeJobResponseBody(name='body'),
}

/**
 * @summary Get document extraction result
 *
 * @param request SubmitDocumentAnalyzeJobRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return SubmitDocumentAnalyzeJobResponse
 */
async function submitDocumentAnalyzeJobWithOptions(request: SubmitDocumentAnalyzeJobRequest, headers: map[string]string, runtime: $RuntimeOptions): SubmitDocumentAnalyzeJobResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.analysisType)) {
    query['analysisType'] = request.analysisType;
  }
  if (!$isNull(request.fileName)) {
    query['fileName'] = request.fileName;
  }
  if (!$isNull(request.fileUrl)) {
    query['fileUrl'] = request.fileUrl;
  }
  if (!$isNull(request.folderId)) {
    query['folderId'] = request.folderId;
  }
  if (!$isNull(request.templateId)) {
    query['templateId'] = request.templateId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'SubmitDocumentAnalyzeJob',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v1/aidoc/document/submitDocumentAnalyzeJob`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Get document extraction result
 *
 * @param request SubmitDocumentAnalyzeJobRequest
 * @return SubmitDocumentAnalyzeJobResponse
 */
async function submitDocumentAnalyzeJob(request: SubmitDocumentAnalyzeJobRequest): SubmitDocumentAnalyzeJobResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return submitDocumentAnalyzeJobWithOptions(request, headers, runtime);
}

async function submitDocumentAnalyzeJobAdvance(request: SubmitDocumentAnalyzeJobAdvanceRequest, headers: map[string]string, runtime: $RuntimeOptions): SubmitDocumentAnalyzeJobResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if($isNull(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if($isNull(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApiUtil.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'energyExpertExternal',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var submitDocumentAnalyzeJobReq = new SubmitDocumentAnalyzeJobRequest{};
  OpenApiUtil.convert(request, submitDocumentAnalyzeJobReq);

  if(!$isNull(request.fileUrlObject)) {
    authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
    ossConfig.accessKeyId = authResponse.body.accessKeyId;
    ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
    ossClient = new OSS(ossConfig);

    fileObj = new FileForm.FileField{
      filename = authResponse.body.objectKey,
      content = request.fileUrlObject,
      contentType = '',
    };
    ossHeader = new OSS.PostObjectRequest.header{
      accessKeyId = authResponse.body.accessKeyId,
      policy = authResponse.body.encodedPolicy,
      signature = authResponse.body.signature,
      key = authResponse.body.objectKey,
      file = fileObj,
      successActionStatus = '201',
    };
    uploadRequest = new OSS.PostObjectRequest{
      bucketName = authResponse.body.bucket,
      header = ossHeader,
    };
    ossClient.postObject(uploadRequest, ossRuntime);
    submitDocumentAnalyzeJobReq.fileUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
  }
  var submitDocumentAnalyzeJobResp = submitDocumentAnalyzeJobWithOptions(submitDocumentAnalyzeJobReq, headers, runtime);
  return submitDocumentAnalyzeJobResp;
}

model SubmitVLExtractionTaskRequest {
  fileName?: string(name='fileName', description='The filename must include the file type suffix.

This parameter is required.', example='example.pdf'),
  fileUrl?: string(name='fileUrl', description='Choose one of fileUrl or fileUrlObject:

- fileUrl: Use by providing the document URL, for a single document (supports up to 1000 pages and 100MB in size)

- fileUrlObject: Use when calling the interface with local file upload, for a single document (supports up to 1000 pages and 100 MB in size)

> The relationship between file parsing methods and supported document types
> - Long Text RAG: Supports pdf, doc/docx, up to 1000 pages
> - Image Processing: Supports pdf, jpg, jpeg, png, bmp
> - Long Text Understanding: Supports pdf, doc/docx, xls/xlsx', example='fileUrl：https://example.com/example.pdf
fileUrlObject：本地文件生成的FileInputStream'),
  folderId?: string(name='folderId', description='- Unique knowledge base folder ID, used when you need to categorize documents and control the scope of online Q&A queries.
- The folder ID needs to be obtained from the intelligent document console after logging in.', example='xxxxx'),
  templateId?: string(name='templateId', description='Unique parsing template ID, used to specify the key-value pairs to be extracted from the document. You need to configure the template on the template management page and then obtain the corresponding template ID.', example='572d24k0c95a'),
}

model SubmitVLExtractionTaskAdvanceRequest {
  fileName?: string(name='fileName', description='The filename must include the file type suffix.

This parameter is required.', example='example.pdf'),
  fileUrlObject?: readable(name='fileUrl', description='Choose one of fileUrl or fileUrlObject:

- fileUrl: Use by providing the document URL, for a single document (supports up to 1000 pages and 100MB in size)

- fileUrlObject: Use when calling the interface with local file upload, for a single document (supports up to 1000 pages and 100 MB in size)

> The relationship between file parsing methods and supported document types
> - Long Text RAG: Supports pdf, doc/docx, up to 1000 pages
> - Image Processing: Supports pdf, jpg, jpeg, png, bmp
> - Long Text Understanding: Supports pdf, doc/docx, xls/xlsx', example='fileUrl：https://example.com/example.pdf
fileUrlObject：本地文件生成的FileInputStream'),
  folderId?: string(name='folderId', description='- Unique knowledge base folder ID, used when you need to categorize documents and control the scope of online Q&A queries.
- The folder ID needs to be obtained from the intelligent document console after logging in.', example='xxxxx'),
  templateId?: string(name='templateId', description='Unique parsing template ID, used to specify the key-value pairs to be extracted from the document. You need to configure the template on the template management page and then obtain the corresponding template ID.', example='572d24k0c95a'),
}

model SubmitVLExtractionTaskResponseBody = {
  data?: {
    taskId?: string(name='taskId', description='Task ID.', example='411ce93a-7eb5-40cf-836a-53c32f097663'),
  }(name='data', description='Returned data structure.'),
  requestId?: string(name='requestId', description='Request ID.', example='83A5A7DD-8974-5769-952E-590A97BEA34E'),
}

model SubmitVLExtractionTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SubmitVLExtractionTaskResponseBody(name='body'),
}

/**
 * @summary Extracts key information from documents using KV templates or prompts with the Qwen-VL model, ideal for image extraction. 
 * Supports:
 * URL Upload: SubmitVLExtractionTask.
 * Local File Upload: SubmitVLExtractionTaskAdvance
 *
 * @param request SubmitVLExtractionTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return SubmitVLExtractionTaskResponse
 */
async function submitVLExtractionTaskWithOptions(request: SubmitVLExtractionTaskRequest, headers: map[string]string, runtime: $RuntimeOptions): SubmitVLExtractionTaskResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.fileName)) {
    query['fileName'] = request.fileName;
  }
  if (!$isNull(request.fileUrl)) {
    query['fileUrl'] = request.fileUrl;
  }
  if (!$isNull(request.folderId)) {
    query['folderId'] = request.folderId;
  }
  if (!$isNull(request.templateId)) {
    query['templateId'] = request.templateId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'SubmitVLExtractionTask',
    version = '2022-09-23',
    protocol = 'HTTPS',
    pathname = `/api/v2/aidoc/document/submitVLExtractionTask`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Extracts key information from documents using KV templates or prompts with the Qwen-VL model, ideal for image extraction. 
 * Supports:
 * URL Upload: SubmitVLExtractionTask.
 * Local File Upload: SubmitVLExtractionTaskAdvance
 *
 * @param request SubmitVLExtractionTaskRequest
 * @return SubmitVLExtractionTaskResponse
 */
async function submitVLExtractionTask(request: SubmitVLExtractionTaskRequest): SubmitVLExtractionTaskResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return submitVLExtractionTaskWithOptions(request, headers, runtime);
}

async function submitVLExtractionTaskAdvance(request: SubmitVLExtractionTaskAdvanceRequest, headers: map[string]string, runtime: $RuntimeOptions): SubmitVLExtractionTaskResponse {
  // Step 0: init client
  var accessKeyId = @credential.getAccessKeyId();
  var accessKeySecret = @credential.getAccessKeySecret();
  var securityToken = @credential.getSecurityToken();
  var credentialType = @credential.getType();
  var openPlatformEndpoint = @openPlatformEndpoint;
  if($isNull(openPlatformEndpoint)) {
    openPlatformEndpoint ='openplatform.aliyuncs.com';
  }
  if($isNull(credentialType)) {
    credentialType ='access_key';
  }
  var authConfig = new OpenApiUtil.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    securityToken = securityToken,
    type = credentialType,
    endpoint = openPlatformEndpoint,
    protocol = @protocol,
    regionId = @regionId,
  };
  var authClient = new OpenPlatform(authConfig);
  var authRequest = new OpenPlatform.AuthorizeFileUploadRequest{
    product = 'energyExpertExternal',
    regionId = @regionId,
  };
  var authResponse = new OpenPlatform.AuthorizeFileUploadResponse{};
  var ossConfig = new OSS.Config{
    accessKeyId = accessKeyId,
    accessKeySecret = accessKeySecret,
    type = 'access_key',
    protocol = @protocol,
    regionId = @regionId,
  };
  var ossClient : OSS = new OSS(ossConfig);

  var fileObj = new FileForm.FileField{};
  var ossHeader = new OSS.PostObjectRequest.header{};
  var uploadRequest = new OSS.PostObjectRequest{};
  var ossRuntime = new OSSUtil.RuntimeOptions{};
  OpenApiUtil.convert(runtime, ossRuntime);
  var submitVLExtractionTaskReq = new SubmitVLExtractionTaskRequest{};
  OpenApiUtil.convert(request, submitVLExtractionTaskReq);

  if(!$isNull(request.fileUrlObject)) {
    authResponse = authClient.authorizeFileUploadWithOptions(authRequest, runtime);
    ossConfig.accessKeyId = authResponse.body.accessKeyId;
    ossConfig.endpoint = OpenApiUtil.getEndpoint(authResponse.body.endpoint, authResponse.body.useAccelerate, @endpointType);
    ossClient = new OSS(ossConfig);

    fileObj = new FileForm.FileField{
      filename = authResponse.body.objectKey,
      content = request.fileUrlObject,
      contentType = '',
    };
    ossHeader = new OSS.PostObjectRequest.header{
      accessKeyId = authResponse.body.accessKeyId,
      policy = authResponse.body.encodedPolicy,
      signature = authResponse.body.signature,
      key = authResponse.body.objectKey,
      file = fileObj,
      successActionStatus = '201',
    };
    uploadRequest = new OSS.PostObjectRequest{
      bucketName = authResponse.body.bucket,
      header = ossHeader,
    };
    ossClient.postObject(uploadRequest, ossRuntime);
    submitVLExtractionTaskReq.fileUrl = `http://${authResponse.body.bucket}.${authResponse.body.endpoint}/${authResponse.body.objectKey}`;
  }
  var submitVLExtractionTaskResp = submitVLExtractionTaskWithOptions(submitVLExtractionTaskReq, headers, runtime);
  return submitVLExtractionTaskResp;
}

